当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentModel::findByPk方法代码示例

本文整理汇总了PHP中ContentModel::findByPk方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentModel::findByPk方法的具体用法?PHP ContentModel::findByPk怎么用?PHP ContentModel::findByPk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentModel的用法示例。


在下文中一共展示了ContentModel::findByPk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 /**
  * compile wrapper element
  */
 protected function compile()
 {
     // get included elements
     if ($this->objWrapper->getType() == ContentWrapper\Model::TYPE_START) {
         $this->Template->count = ContentWrapper\Repository::countRelatedElements($this->objWrapper);
         $cssID = $this->cssID;
         if ($cssID[0] == '') {
             $cssID[0] = sprintf($this->strIdentifier, $this->id);
             $this->cssID = $cssID;
         }
     } else {
         $start = \ContentModel::findByPk($this->bootstrap_parentId);
         if ($start !== null) {
             $start = new Attributes($start);
             $start->registerNamespaceAttributes($this->arrBootstrapAttributes);
             $start->cssID = deserialize($start->cssID, true);
             $this->Template->start = $start;
             if ($start->cssID[0] == '') {
                 $cssID = $start->cssID;
                 $cssID[0] = sprintf($this->strIdentifier, $start->id);
                 $this->cssID = $cssID;
             } else {
                 $this->cssID = $start->cssID;
             }
         }
     }
     $this->Template->identifier = $this->cssID[0];
 }
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:31,代码来源:Carousel.php

示例2: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     $objElement = \ContentModel::findByPk($this->cteAlias);
     if ($objElement === null) {
         return '';
     }
     $strClass = static::findClass($objElement->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objElement->origId = $objElement->id;
     $objElement->id = $this->id;
     $objElement->typePrefix = 'ce_';
     /** @var \ContentElement $objElement */
     $objElement = new $strClass($objElement);
     // create new cssID array
     $cssID = array();
     // set the ID
     $cssID[0] = $this->cssID[0] ?: $objElement->cssID[0];
     // merge the classes
     $arrElementClasses = explode(' ', $this->cssID[1]);
     $arrIncludeClasses = explode(' ', $objElement->cssID[1]);
     $cssID[1] = implode(' ', array_unique(array_merge($arrIncludeClasses, $arrElementClasses)));
     // Overwrite spacing and CSS ID
     $objElement->origSpace = $objElement->space;
     $objElement->space = $this->space;
     $objElement->origCssID = $objElement->cssID;
     $objElement->cssID = $cssID;
     return $objElement->generate();
 }
开发者ID:fritzmg,项目名称:contao-mergecssclasses,代码行数:35,代码来源:ContentAliasMerged_C35.php

示例3: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     $objElement = \ContentModel::findByPk($this->cteAlias);
     if ($objElement === null) {
         return '';
     }
     $strClass = static::findClass($objElement->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objElement->origId = $objElement->id;
     $objElement->id = $this->id;
     $objElement->typePrefix = 'ce_';
     /** @var ContentElement $objElement */
     $objElement = new $strClass($objElement);
     $cssID = deserialize($objElement->cssID, true);
     // Override the CSS ID (see #305)
     if (!empty($this->cssID[0])) {
         $cssID[0] = $this->cssID[0];
     }
     // Merge the CSS classes (see #6011)
     if (!empty($this->cssID[1])) {
         $cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
     }
     $objElement->cssID = $cssID;
     return $objElement->generate();
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:32,代码来源:ContentAlias.php

示例4: compile

 /**
  * compile wrapper element
  */
 protected function compile()
 {
     if ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_START)) {
         $cssID = $this->cssID;
         if ($cssID[0] == '') {
             $cssID[0] = sprintf($this->identifier, $this->id);
             $this->cssID = $cssID;
         }
         $attributes = new Attributes();
         $attributes->addClass('carousel')->addClass('slide')->setAttribute('id', $cssID[0]);
         if ($this->bootstrap_autostart) {
             $attributes->setAttribute('data-ride', 'carousel');
         }
         if ($this->bootstrap_interval > 0) {
             $attributes->setAttribute('data-interval', $this->bootstrap_interval);
         }
         $this->Template->attributes = $attributes;
         $this->Template->count = $this->wrapper->countRelatedElements();
     } else {
         $start = \ContentModel::findByPk($this->bootstrap_parentId);
         if ($start !== null) {
             $start->cssID = deserialize($start->cssID, true);
             $this->Template->start = $start;
             if ($start->cssID[0] == '') {
                 $cssID = $start->cssID;
                 $cssID[0] = sprintf($this->identifier, $start->id);
                 $this->cssID = $cssID;
             } else {
                 $this->cssID = $start->cssID;
             }
         }
     }
     $this->Template->identifier = $this->cssID[0];
     $this->Template->wrapper = $this->wrapper;
 }
开发者ID:Olli,项目名称:components,代码行数:38,代码来源:Carousel.php

示例5: modifyPalette

 public function modifyPalette(DataContainer $dc)
 {
     $objElement = \ContentModel::findByPk($dc->id);
     if ($objElement === null || $objElement->type != 'linkteaser' || $objElement->source != 'modal') {
         return false;
     }
     $GLOBALS['TL_DCA']['tl_content']['fields']['jumpTo']['label'] =& $GLOBALS['TL_LANG']['tl_content']['modalJumpTo'];
     $GLOBALS['TL_DCA']['tl_content']['fields']['jumpTo']['eval']['mandatory'] = false;
     $GLOBALS['TL_DCA']['tl_content']['fields']['jumpTo']['eval']['tl_class'] = 'clr w50';
 }
开发者ID:heimrichhannot,项目名称:contao-modal,代码行数:10,代码来源:tl_content.php

示例6: __invoke

 /**
  * Invoke the rendering.
  *
  * @param array $row The child as array.
  *
  * @return mixed|string
  */
 public function __invoke($row)
 {
     $buffer = call_user_func($this->callback, $row);
     if ($row['ptable'] === 'tl_content_node') {
         $parent = \ContentModel::findByPk($row['pid']);
         if ($this->registry->hasNodeType($parent->type)) {
             $node = $this->registry->getNode($parent->type);
             return $node->generateChildInBackendView($row, $buffer);
         }
     }
     return $buffer;
 }
开发者ID:netzmacht,项目名称:contao-content-node,代码行数:19,代码来源:BackendRenderer.php

示例7: modifyPalette

 /**
  * Modify the current datacontainer palette
  *
  * @param \DataContainer $dc
  *
  * @return bool
  */
 public function modifyPalette(\DataContainer $dc)
 {
     $id = strlen(\Input::get('id')) ? \Input::get('id') : CURRENT_ID;
     $objModel = \ContentModel::findByPk($id);
     if ($objModel === null || $objModel->type != 'linkteaser') {
         return false;
     }
     $dca =& $GLOBALS['TL_DCA']['tl_content'];
     // make text non mandatory
     $dca['fields']['text']['eval']['mandatory'] = false;
     $dca['fields']['target']['load_callback'][] = array(__CLASS__, 'setTargetFlags');
 }
开发者ID:heimrichhannot,项目名称:contao-teaser,代码行数:19,代码来源:Content.php

示例8: redirect

 /**
  * Redirect to the content page when trying to access the content node.
  *
  * This fixes the edit links on the header.
  *
  * @return void
  */
 public function redirect()
 {
     if ($this->input->get('table') === 'tl_content_node') {
         $model = \ContentModel::findByPk($this->input->get('id'));
         if (!$model) {
             \Controller::log(sprintf('Content node "%s" not found', $this->input->get('id')), __METHOD__, TL_ERROR);
             \Controller::redirect('contao/main.php?act=error');
         }
         $nodes = $model->ptable === 'tl_content_node' ? '1' : '';
         $url = \Backend::addToUrl('table=tl_content&nodes=' . $nodes);
         \Controller::redirect($url);
     }
 }
开发者ID:netzmacht,项目名称:contao-content-node,代码行数:20,代码来源:RedirectHelper.php

示例9: generate

 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     $objElement = \ContentModel::findByPk($this->cteAlias);
     if ($objElement === null) {
         return '';
     }
     $strClass = $this->findContentElement($objElement->type);
     if (!$this->classFileExists($strClass)) {
         return '';
     }
     $objElement->id = $this->id;
     $objElement->typePrefix = 'ce_';
     $objElement = new $strClass($objElement);
     // Overwrite spacing and CSS ID
     $objElement->space = $this->space;
     $objElement->cssID = $this->cssID;
     return $objElement->generate();
 }
开发者ID:rikaix,项目名称:core,代码行数:22,代码来源:ContentAlias.php

示例10: countRequiredTabSeparators

 /**
  * Count required tab separator elements.
  *
  * @param \Database\Result $model  Current row.
  * @param Helper           $helper Wrapper helper.
  *
  * @return int
  */
 public function countRequiredTabSeparators(\Database\Result $model, Helper $helper)
 {
     if (!$helper->isTypeOf(Helper::TYPE_START)) {
         $model = \ContentModel::findByPk($model->bootstrap_parentId);
     }
     $tabs = array();
     if ($model->bootstrap_tabs) {
         $tabs = deserialize($model->bootstrap_tabs, true);
     } elseif (\Input::post('bootstrap_tabs')) {
         $tabs = \Input::post('bootstrap_tabs');
     }
     $count = 0;
     foreach ($tabs as $tab) {
         if ($tab['type'] != 'dropdown') {
             $count++;
         }
     }
     return $count > 0 ? $count - 1 : 0;
 }
开发者ID:contao-bootstrap,项目名称:components,代码行数:27,代码来源:Content.php

示例11: countRequiredTabSeparators

 /**
  * count required tab separator elements
  *
  * @param ContentWrapper\Model $model
  *
  * @return int
  */
 public function countRequiredTabSeparators(ContentWrapper\Model $model)
 {
     if ($model->getType() != ContentWrapper\Model::TYPE_START) {
         $model = \ContentModel::findByPk($model->bootstrap_parentId);
     }
     $tabs = array();
     if ($model->bootstrap_tabs) {
         $tabs = deserialize($model->bootstrap_tabs, true);
     } elseif (\Input::post('bootstrap_tabs')) {
         $tabs = \Input::post('bootstrap_tabs');
     }
     $count = 0;
     foreach ($tabs as $tab) {
         if ($tab['type'] != 'dropdown') {
             $count++;
         }
     }
     return $count > 0 ? $count - 1 : 0;
 }
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:26,代码来源:Content.php

示例12: generate

 public function generate()
 {
     if (TL_MODE == 'BE') {
         $this->strTemplate = 'be_wildcard';
         $this->Template = new \BackendTemplate($this->strTemplate);
         $this->Template->title = $this->headline;
     }
     parent::generate();
     $objConfig = SlickConfigModel::findByPk($this->slickConfig);
     if ($objConfig === null) {
         return;
     }
     $objSlider = \ContentModel::findByPk($this->slickContentSlider);
     if ($objSlider === null) {
         return;
     }
     $this->Template->class .= ' slick-nav ' . SlickConfig::getCssClassFromModel($objConfig) . ' slick';
     $this->Template->syncTo = SlickConfig::getCssClassForContent($this->slickContentSlider);
     return $this->Template->parse();
 }
开发者ID:heimrichhannot,项目名称:contao-slick,代码行数:20,代码来源:ContentSlickNavStart.php

示例13: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     $objElement = \ContentModel::findByPk($this->cteAlias);
     if ($objElement === null) {
         return '';
     }
     $strClass = static::findClass($objElement->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objElement->origId = $objElement->id;
     $objElement->id = $this->id;
     $objElement->typePrefix = 'ce_';
     /** @var \ContentElement $objElement */
     $objElement = new $strClass($objElement);
     // Overwrite spacing and CSS ID
     $objElement->origSpace = $objElement->space;
     $objElement->space = $this->space;
     $objElement->origCssID = $objElement->cssID;
     $objElement->cssID = $this->cssID;
     return $objElement->generate();
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:27,代码来源:ContentAlias.php

示例14: generate

 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         // create new backend template
         $objTemplate = new \BackendTemplate('be_include');
         // get the element
         $objElement = \ContentModel::findByPk($this->cteAlias);
         if ($objElement === null) {
             return '';
         }
         // get the parent article
         $objArticle = \ArticleModel::findByPk($objElement->pid);
         if ($objArticle === null) {
             return parent::generate();
         }
         // get the parent pages
         $objPages = \PageModel::findParentsById($objArticle->pid);
         if ($objPages === null) {
             return parent::generate();
         }
         // get the page titles
         $arrPageTitles = array_reverse($objPages->fetchEach('title'));
         // set breadcrumb to original element
         $objTemplate->original = array('crumbs' => implode(' » ', $arrPageTitles), 'article' => array('title' => $objArticle->title, 'link' => 'contao/main.php?do=article&table=tl_content&id=' . $objArticle->id . '&rt=' . REQUEST_TOKEN));
         // get include breadcrumbs
         $includes = \IncludeInfoHelper::getIncludes('cteAlias', $this->cteAlias, $this->id);
         // set include breadcrumbs
         if (count($includes) > 1) {
             $objTemplate->includes = $includes;
         }
         // add CSS
         $GLOBALS['TL_CSS'][] = \IncludeInfoHelper::BACKEND_CSS;
         // return info + content
         return $objTemplate->parse() . parent::generate();
     }
     // return content only
     return parent::generate();
 }
开发者ID:fritzmg,项目名称:contao-be-include-info,代码行数:42,代码来源:ContentAliasExtended.php

示例15: showJsLibraryHint

 /**
  * Show a hint if a JavaScript library needs to be included in the page layout
  *
  * @param object
  */
 public function showJsLibraryHint($dc)
 {
     if ($_POST || Input::get('act') != 'edit') {
         return;
     }
     // Return if the user cannot access the layout module (see #6190)
     if (!$this->User->hasAccess('themes', 'modules') || !$this->User->hasAccess('layout', 'themes')) {
         return;
     }
     $objCte = \ContentModel::findByPk($dc->id);
     if ($objCte === null) {
         return;
     }
     switch ($objCte->type) {
         case 'gallery':
             Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplates'], 'moo_mediabox', 'j_colorbox'));
             break;
         case 'sliderStart':
         case 'sliderStop':
             Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplates'], 'moo_slider', 'j_slider'));
             break;
         case 'accordionSingle':
         case 'accordionStart':
         case 'accordionStop':
             Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplates'], 'moo_accordion', 'j_accordion'));
             break;
         case 'player':
             Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplate'], 'j_mediaelement'));
             break;
         case 'table':
             if ($objCte->sortable) {
                 Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_content']['includeTemplates'], 'moo_tablesort', 'j_tablesort'));
             }
             break;
     }
 }
开发者ID:fritzmg,项目名称:contao-youtube-iframe,代码行数:41,代码来源:tl_content.php


注:本文中的ContentModel::findByPk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。