コード例 #1
0
 /**
  * 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']);
             }
         }
     }
 }
コード例 #2
0
ファイル: Tab.php プロジェクト: netzmacht/contao-bootstrap
 /**
  * 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;
     }
 }
コード例 #3
0
ファイル: Tab.php プロジェクト: Olli/components
 /**
  * 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;
     }
 }
コード例 #4
0
ファイル: TabElement.php プロジェクト: contao-bootstrap/tab
 /**
  * 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;
 }
コード例 #5
0
 /**
  * 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']);
         }
     }
 }