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


PHP ContentModel::findByPK方法代码示例

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


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

示例1: appendColumnsetIdToPalette

 /**
  * Add column set field to the colsetStart content element.
  *
  * We need to do it dynamically because subcolumns creates its palette dynamically.
  *
  * @param \DataContainer $dataContainer The data container driver.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function appendColumnsetIdToPalette($dataContainer)
 {
     if ($GLOBALS['TL_CONFIG']['subcolumns'] != 'bootstrap_customizable') {
         return;
     }
     if ($dataContainer->table == 'tl_content') {
         $model = \ContentModel::findByPK($dataContainer->id);
         if ($model->sc_type > 0) {
             \MetaPalettes::appendFields($dataContainer->table, 'colsetStart', 'colset', array('columnset_id'));
         }
     } else {
         $model = \ModuleModel::findByPk($dataContainer->id);
         if ($model->sc_type > 0) {
             if ($model->sc_type > 0) {
                 $GLOBALS['TL_DCA']['tl_module']['palettes']['subcolumns'] = str_replace('sc_type,', 'sc_type,columnset_id,', $GLOBALS['TL_DCA']['tl_module']['palettes']['subcolumns']);
             }
         }
     }
 }
开发者ID:contao-bootstrap,项目名称:grid-editor,代码行数:30,代码来源:ColumnSet.php

示例2: __construct

 /**
  * prepare tab content element
  * @param $objElement
  */
 public function __construct($objElement)
 {
     parent::__construct($objElement);
     // load tab definitions
     if ($this->objWrapper->getType() == ContentWrapper\Model::TYPE_START) {
         $tabs = deserialize($this->tabs, true);
         $tab = null;
         foreach ($tabs as $i => $t) {
             $tabs[$i]['id'] = standardize($t['title']);
             if ($t['type'] != 'dropdown' && $tab === null) {
                 $tab = $tabs[$i];
             }
         }
         $this->arrTabs = $tabs;
         $this->arrTab = $tab;
         $this->fade = $this->bootstrap_fade;
     } elseif ($this->objWrapper->getType() == ContentWrapper\Model::TYPE_SEPARATOR) {
         $elements = $this->Database->prepare('SELECT id FROM tl_content WHERE bootstrap_parentId=? ORDER by sorting')->execute($this->bootstrap_parentId);
         /** @var \Database\Result $elements */
         $elements = array_merge(array($this->bootstrap_parentId), $elements->fetchEach('id'));
         $index = 0;
         $parent = \ContentModel::findByPK($this->bootstrap_parentId);
         if ($parent) {
             $parent = new ContentWrapper\Model($parent);
             $this->fade = $parent->bootstrap_fade;
         }
         $tabs = deserialize($parent->bootstrap_tabs, true);
         foreach ($tabs as $i => $t) {
             $tabs[$i]['id'] = standardize($t['title']);
             if ($t['type'] != 'dropdown') {
                 if ($elements[$index] == $this->id) {
                     $this->arrTab = $tabs[$i];
                 }
                 $index++;
             }
         }
         $this->arrTabs = $tabs;
     }
 }
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:43,代码来源:Tab.php

示例3: __construct

 /**
  * prepare tab content element
  * @param $objElement
  */
 public function __construct($objElement)
 {
     parent::__construct($objElement);
     // load tab definitions
     if ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_START)) {
         $tabs = deserialize($this->bootstrap_tabs, true);
         $tab = null;
         foreach ($tabs as $i => $t) {
             $tabs[$i]['id'] = standardize($t['title']);
             if ($t['type'] != 'dropdown' && !$tab) {
                 $tab = $tabs[$i];
             }
         }
         $this->currentTab = $tab;
         $this->tabs = $tabs;
         $this->fade = $this->bootstrap_fade;
     } elseif ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_SEPARATOR)) {
         $elements = \Database::getInstance()->prepare('SELECT id FROM tl_content WHERE bootstrap_parentId=? ORDER by sorting')->execute($this->bootstrap_parentId);
         $elements = array_merge(array($this->bootstrap_parentId), $elements->fetchEach('id'));
         $parent = \ContentModel::findByPK($this->bootstrap_parentId);
         $index = 0;
         if ($parent) {
             $this->fade = $parent->bootstrap_fade;
         }
         $tabs = deserialize($parent->bootstrap_tabs, true);
         foreach ($tabs as $i => $t) {
             $tabs[$i]['id'] = standardize($t['title']);
             if ($t['type'] != 'dropdown') {
                 if ($elements[$index] == $this->id) {
                     $this->currentTab = $tabs[$i];
                     break;
                 }
                 $index++;
             }
         }
         $this->tabs = $tabs;
     }
 }
开发者ID:Olli,项目名称:components,代码行数:42,代码来源:Tab.php

示例4: initializeSeparator

 /**
  * Initialize separator.
  *
  * @return void
  */
 private function initializeSeparator()
 {
     $elements = \Database::getInstance()->prepare('SELECT id FROM tl_content WHERE bootstrap_parentId=? ORDER by sorting')->execute($this->bootstrap_parentId);
     $elements = array_merge(array($this->bootstrap_parentId), $elements->fetchEach('id'));
     $parent = \ContentModel::findByPK($this->bootstrap_parentId);
     $index = 0;
     if ($parent) {
         $this->fade = $parent->bootstrap_fade;
     }
     $tabs = deserialize($parent->bootstrap_tabs, true);
     $ids = array();
     foreach ($tabs as $i => $t) {
         $cssId = standardize($t['title']);
         $cssId .= '-' . $this->bootstrap_parentId;
         if (in_array($cssId, $ids)) {
             $cssId = $i . '-' . $cssId;
         }
         $ids[] = $cssId;
         $tabs[$i]['id'] = $cssId;
         if ($t['type'] != 'dropdown') {
             if ($elements[$index] == $this->id) {
                 $this->currentTab = $tabs[$i];
                 break;
             }
             $index++;
         }
     }
     $this->tabs = $tabs;
 }
开发者ID:contao-bootstrap,项目名称:tab,代码行数:34,代码来源:TabElement.php

示例5: appendColumnsetIdToPalette

 /**
  * Add column set field to the colsetStart content element.
  *
  * We need to do it dynamically because subcolumns creates its palette dynamically.
  *
  * @param \DataContainer $dataContainer The data container driver.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function appendColumnsetIdToPalette($dataContainer)
 {
     if ($dataContainer->table == 'tl_content') {
         $model = \ContentModel::findByPK($dataContainer->id);
         if ($model->sc_type > 0) {
             \MetaPalettes::appendFields($dataContainer->table, 'colsetStart', 'colset', array('bootstrap_grid'));
         }
     } elseif ($dataContainer->table == 'tl_form_field') {
         $model = \FormFieldModel::findByPk($dataContainer->id);
         if ($model->fsc_type > 0) {
             $GLOBALS['TL_DCA']['tl_form_field']['palettes']['formcolstart'] = str_replace('fsc_color,', 'fsc_color,bootstrap_grid,', $GLOBALS['TL_DCA']['tl_form_field']['palettes']['formcolstart']);
         }
     } else {
         $model = \ModuleModel::findByPk($dataContainer->id);
         if ($model->sc_type > 0) {
             $GLOBALS['TL_DCA']['tl_module']['palettes']['subcolumns'] = str_replace('sc_type,', 'sc_type,columnset_id,', $GLOBALS['TL_DCA']['tl_module']['palettes']['subcolumns']);
         }
     }
 }
开发者ID:contao-bootstrap,项目名称:grid-editor,代码行数:30,代码来源:Subcolumns.php


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