Example #1
0
 /**
  * Modify palette if bootstrap is used.
  *
  * Hook palettes_hook (MetaPalettes) is called.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function generatePalette()
 {
     // @codingStandardsIgnoreStart
     // TODO: How to handle editAll actions?
     // @codingStandardsIgnoreEnd
     if (Input::get('table') != 'tl_layout' || Input::get('act') != 'edit') {
         return;
     }
     $layout = LayoutModel::findByPk(Input::get('id'));
     // dynamically render palette so that extensions can plug into default palette
     if ($layout->layoutType == 'bootstrap') {
         $metaPalettes =& $GLOBALS['TL_DCA']['tl_layout']['metapalettes'];
         $metaPalettes['__base__'] = $this->getMetaPaletteOfPalette('tl_layout');
         $metaPalettes['default extends __base__'] = Bootstrap::getConfigVar('layout.metapalette', array());
         // unset default palette. otherwise metapalettes will not render this palette
         unset($GLOBALS['TL_DCA']['tl_layout']['palettes']['default']);
         $subSelectPalettes = Bootstrap::getConfigVar('layout.metasubselectpalettes', array());
         foreach ($subSelectPalettes as $field => $meta) {
             foreach ($meta as $value => $definition) {
                 unset($GLOBALS['TL_DCA']['tl_layout']['subpalettes'][$field . '_' . $value]);
                 $GLOBALS['TL_DCA']['tl_layout']['metasubselectpalettes'][$field][$value] = $definition;
             }
         }
     } else {
         MetaPalettes::appendFields('tl_layout', 'title', array('layoutType'));
     }
 }
Example #2
0
 /**
  * Generate the dropdown.
  *
  * @return string
  */
 public function generate()
 {
     $toggle = clone $this->toggle;
     $toggle->addAttributes($this->attributes);
     $toggle->setLabel($toggle->getLabel() . ' ' . Bootstrap::getConfigVar('dropdown.toggle'));
     return sprintf('%s<ul class="dropdown-menu">%s%s</ul>', $toggle, PHP_EOL, $this->generateChildren());
 }
Example #3
0
 /**
  * Replace insert tags.
  *
  * @param ReplaceInsertTagsEvent $event Replace insert tags event.
  *
  * @return void
  */
 public function replaceIconInsertTag(ReplaceInsertTagsEvent $event)
 {
     if ($event->getTag() == 'icon' || $event->getTag() == 'i') {
         $icon = Bootstrap::generateIcon($event->getParam(0), $event->getParam(1));
         $event->setHtml($icon);
         $event->stopPropagation();
     }
 }
Example #4
0
 /**
  * Select the view layout if bootstrap is enabled.
  *
  * @param ViewEvent $event The event.
  *
  * @return void
  */
 public function setViewLayout(ViewEvent $event)
 {
     if (Bootstrap::isEnabled()) {
         $view = $event->getView();
         $view->setLayout('bootstrap');
         $view->getAttributes()->addClass('form-group');
     }
 }
 /**
  * Compile accordion group.
  *
  * @return void
  */
 protected function compile()
 {
     if ($this->wrapper->isTypeOf(Wrapper\Helper::TYPE_START)) {
         Bootstrap::setConfigVar('runtime.accordion-group', 'accordion-group-' . $this->id);
         $this->Template->groupId = Bootstrap::getConfigVar('runtime.accordion-group');
     } else {
         Bootstrap::setConfigVar('runtime.accordion-group', null);
     }
 }
 /**
  * Get the bootstrap config for the form context.
  *
  * @param \FormModel|null $formModel The form model to which the widget belongs.
  *
  * @return ContextualConfig
  */
 protected static function getConfig($formModel = null)
 {
     if (!$formModel) {
         return Bootstrap::getConfig();
     }
     if (!isset(static::$configs[$formModel->id])) {
         $collection = BootstrapConfigModel::findMultipleByIds(deserialize($formModel->bootstrap_configs, true));
         $config = static::getTypeManager()->buildContextualConfig($collection);
         static::$configs[$formModel->id] = $config;
     }
     return static::$configs[$formModel->id];
 }
Example #7
0
 /**
  * Get all icon set names.
  *
  * @return array
  */
 public function getIconSets()
 {
     $options = array();
     $sets = Bootstrap::getConfigVar('icons.sets', array());
     foreach ($sets as $name => $config) {
         if (isset($config['label'])) {
             $options[$name] = $config['label'];
         } else {
             $options[$name] = $name;
         }
     }
     return $options;
 }
Example #8
0
 /**
  * Listen to the form field hook.
  *
  * @param \Widget $widget The form field hook.
  *
  * @return \Widget
  */
 public function loadFormField($widget)
 {
     if (Bootstrap::isEnabled()) {
         // Force table less mode in the form field. Otherwise it is not rendered.
         if ($widget->type === 'fieldset') {
             $widget->tableless = true;
         }
         // Force table less mode otherwise table html would be created.
         if ($widget instanceof \MadeYourDay\Contao\Form\AntispamField) {
             $widget->tableless = true;
         }
     }
     return $widget;
 }
Example #9
0
 /**
  * @param \Template $template
  */
 public static function setAccordionState(\Template $template)
 {
     $group = static::getGroup();
     if ($group) {
         if (Bootstrap::getConfigVar('runtime.accordion-group-first')) {
             $template->accordion = 'collapse in';
             Bootstrap::setConfigVar('runtime.accordion-group-first', false);
         } else {
             $template->accordion = 'collapse';
         }
     } else {
         $template->accordion = $template->accordion == 'accordion' ? 'collapse' : $template->accordion;
     }
 }
Example #10
0
 /**
  * compile button element, inspired by ContentHyperlink
  */
 protected function compile()
 {
     if ($this->linkTitle == '') {
         $this->linkTitle = $this->url;
     }
     $attributes = new Attributes();
     $attributes->addClass('btn');
     // @See: #6258
     if (TL_MODE != 'BE') {
         $attributes->setAttribute('title', $this->titleText ?: $this->linkTitle);
     }
     if (substr($this->url, 0, 7) == 'mailto:') {
         $attributes->setAttribute('href', \String::encodeEmail($this->url));
     } else {
         $attributes->setAttribute('href', ampersand($this->url));
     }
     if (strncmp($this->rel, 'lightbox', 8) !== 0) {
         $attributes->setAttribute('rel', $this->rel);
     } else {
         $attributes->setAttribute('data-lightbox', substr($this->rel, 9, -1));
     }
     // Override the link target
     if ($this->target) {
         $attributes->setAttribute('target', '_blank');
     }
     if ($this->cssID[1] == '') {
         $attributes->addClass('btn-default');
     } else {
         $attributes->addClass($this->cssID[1]);
     }
     if ($this->icon) {
         $this->Template->icon = Bootstrap::generateIcon($this->bootstrap_icon);
     }
     // add data attributes
     $this->bootstrap_dataAttributes = deserialize($this->bootstrap_dataAttributes, true);
     if (!empty($this->bootstrap_dataAttributes)) {
         foreach ($this->bootstrap_dataAttributes as $attribute) {
             if (trim($attribute['value']) != '' && $attribute['name'] != '') {
                 $attributes->setAttribute('data-' . $attribute['name'], $attribute['value']);
             }
         }
     }
     $this->Template->attributes = $attributes;
     $this->Template->link = $this->linkTitle;
 }
Example #11
0
 /**
  * Compile button element, inspired by ContentHyperlink.
  *
  * @return void
  */
 protected function compile()
 {
     $attributes = new Attributes();
     $this->setLinkTitle($attributes);
     $this->setHref($attributes);
     $this->setCssClass($attributes);
     $this->enableLightbox($attributes);
     $this->setDataAttributes($attributes);
     // Override the link target
     if ($this->target) {
         $attributes->setAttribute('target', '_blank');
     }
     if ($this->bootstrap_icon) {
         $this->Template->icon = Bootstrap::generateIcon($this->bootstrap_icon);
     }
     $this->Template->attributes = $attributes;
     $this->Template->link = $this->linkTitle;
 }
Example #12
0
 /**
  * @param $module
  * @param \ModuleModel $model
  * @return array
  */
 protected function generateModule($module, \ModuleModel $model)
 {
     $class = $module['cssClass'];
     if ($module['floating']) {
         if ($class != '') {
             $class .= ' ';
         }
         $class .= 'navbar-' . $module['floating'];
     }
     // TODO: Do we have to make this list configurable?
     if (in_array($model->type, array('navigation', 'customnav', 'quicklink'))) {
         $navClass = 'nav navbar-nav';
         if ($module['floating']) {
             $navClass .= ' navbar-' . $module['floating'];
         }
         Bootstrap::setConfigVar('runtime.nav-class', $navClass);
     }
     $rendered = $this->getFrontendModule($model);
     Bootstrap::setConfigVar('runtime.nav-class', '');
     return array('type' => 'module', 'module' => $rendered, 'id' => $module['module'], 'class' => $class);
 }
Example #13
0
 /**
  * Parse current template.
  *
  * @param string $buffer       Parsed template.
  * @param string $templateName Name of the template.
  *
  * @return string
  */
 public function parse($buffer, $templateName)
 {
     if (!Bootstrap::isEnabled()) {
         return $buffer;
     }
     foreach ((array) Bootstrap::getConfigVar('templates.parsers') as $config) {
         if ($config['disabled'] || !$this->isTemplateAffected($templateName, (array) $config['templates'])) {
             continue;
         }
         if ($config['type'] == 'replace') {
             if (is_callable($config['replace'])) {
                 $value = call_user_func($config['replace'], $buffer, $templateName);
             } else {
                 $value = $config['replace'];
             }
             $buffer = str_replace($config['search'], $value, $buffer);
         } elseif ($config['type'] == 'callback') {
             $buffer = call_user_func($config['callback'], $buffer, $templateName);
         }
     }
     return $buffer;
 }
Example #14
0
 /**
  * @return string
  */
 private function getContent()
 {
     $config = Bootstrap::getConfig();
     switch ($this->bootstrap_modalContentType) {
         case 'article':
             return $this->getArticle($this->bootstrap_article, false, true);
             break;
         case 'form':
             $config->set('runtime.modal-footer', '');
             $content = $this->getForm($this->form);
             $this->formButtons = $config->get('runtime.modal-footer');
             $config->set('runtime.modal-footer', false);
             // render style select if it is used
             // TODO move this to an event or hook
             if ($this->isAjax && $config->get('form.styleSelect.enabled')) {
                 $content .= sprintf('<script>$(\'.%s\').selectpicker(\'render\');</script>', $config->get('form.styleSelect.class'));
             }
             return $content;
             break;
         case 'module':
             return $this->getFrontendModule($this->bootstrap_module);
             break;
         case 'html':
             return TL_MODE == 'FE' ? $this->html : htmlspecialchars($this->bootstrap_html);
             break;
         case 'template':
             ob_start();
             include $this->getTemplate($this->bootstrap_modalTemplate);
             $buffer = ob_get_contents();
             ob_end_clean();
             return $buffer;
             break;
         case 'text':
             return \String::toHtml5($this->bootstrap_text);
             break;
     }
     return '';
 }
Example #15
0
 /**
  * Replace css classes.
  *
  * @param string $buffer Output buffer.
  *
  * @return string
  */
 public static function replaceCssClasses($buffer)
 {
     $replaceClasses = Bootstrap::getConfigVar('layout.replace-css-classes');
     if (empty($replaceClasses)) {
         return $buffer;
     }
     $classes = array_keys($replaceClasses);
     $classes = array_map(function ($class) {
         return preg_quote($class, '~');
     }, $classes);
     $search = sprintf('~class="([^"]*(%s)[^"]*)"~', implode('|', $classes));
     $buffer = preg_replace_callback($search, function ($matches) use($replaceClasses) {
         $classes = explode(' ', $matches[1]);
         $classes = array_filter($classes);
         foreach ($classes as $index => $class) {
             if (array_key_exists($class, $replaceClasses)) {
                 $classes[$index] = $replaceClasses[$class];
             }
         }
         return sprintf('class="%s"', implode(' ', $classes));
     }, $buffer);
     return $buffer;
 }
Example #16
0
 /**
  * @param \Model $element
  * @param $isVisible
  * @return bool
  */
 public static function setRuntimeNavClass(\Model $element, $isVisible)
 {
     // load module if it is a module include element
     if ($element instanceof \ContentModel && $element->type == 'module') {
         $element = \ModuleModel::findByPK($element->module);
     }
     if (!$element instanceof \ModuleModel) {
         return $isVisible;
     }
     // do not limit for navigation module. so every module can access it
     // bootstrap_inNavbar is dynamically set of navbar module
     if ($element->bootstrap_inNavbar) {
         $class = 'nav navbar-nav';
         if ($element->bootstrap_navbarFloating == 'right') {
             $class .= 'navbar-right';
         }
     } elseif ($element->bootstrap_navClass) {
         $class = $element->bootstrap_navClass;
     } else {
         $class = 'nav nav-default';
     }
     Bootstrap::setConfigVar('runtime.nav-class', $class);
     return $isVisible;
 }
Example #17
0
 /**
  * Generate the widget and return it as string.
  *
  * @return string
  */
 public function generate()
 {
     $buttonClass = $this->strClass ? $this->strClass : Bootstrap::getConfigVar('form.default-submit-btn');
     $button = Element::create('button', $this->arrAttributes)->setId('ctrl_' . $this->strId)->addAttributes(array('type' => 'submit', 'class' => array('submit', 'btn', $buttonClass), 'title' => specialchars($this->slabel)));
     if ($this->imageSubmit) {
         $model = \FilesModel::findByPk($this->singleSRC);
         if ($model !== null && is_file(TL_ROOT . '/' . $model->path)) {
             $button->addChild(\Image::getHtml($model->path, $this->slabel));
             return $button;
         }
     }
     $label = specialchars($this->slabel);
     if ($this->bootstrap_addIcon) {
         $icon = Bootstrap::generateIcon($this->bootstrap_icon);
         if ($this->bootstrap_iconPosition == 'right') {
             $button->addChild($label)->addChild(' ' . $icon);
         } else {
             $button->addChild($icon . ' ')->addChild($label);
         }
     } else {
         $button->addChild($label);
     }
     return $button;
 }
Example #18
0
 /**
  * Get full type name.
  *
  * @param string $type Type name.
  *
  * @return string
  */
 public function getTypeName($type = null)
 {
     $group = $this->getGroup();
     $type = $type === null ? $this->getType() : $type;
     $path = sprintf('wrappers.%s.%s.name', $group, $type);
     return Bootstrap::getConfigVar($path);
 }
Example #19
0
 /**
  * Initialize the helper.
  *
  * @return void
  */
 private function initialize()
 {
     $level = substr($this->template->level, 6);
     $attributes = $this->listAttributes;
     $attributes->addClass($this->template->level);
     if ($level === '1') {
         $class = Bootstrap::getConfigVar('runtime.nav-class');
         if ($class) {
             $attributes->addClass('nav');
             $attributes->addClass($class);
             Bootstrap::setConfigVar('runtime.nav-class', '');
         }
     } elseif ($level === '2') {
         $attributes->addClass('dropdown-menu');
     }
     if ($level > 1 && $this->template->items) {
         // get the current page id
         $pageId = $this->template->items[0]['pid'];
         $page = \PageModel::findByPk($pageId);
         if ($this->disableChildrenList($level, $page)) {
             $this->setChildrenList(false);
         }
     }
 }
Example #20
0
<?php

/**
 * @package   contao-bootstrap
 * @author    David Molineus <*****@*****.**>
 * @license   LGPL 3+
 * @copyright 2013-2015 netzmacht creative David Molineus
 */
$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array('Netzmacht\\Bootstrap\\Core\\Contao\\DataContainer\\Wrapper', 'enableFixParentPalette');
// define default bootstrap palette
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['_bootstrap_default_'] = array('type' => array('type', 'headline'), 'link' => array(), 'config' => array(), 'protected' => array(':hide', 'protected'), 'expert' => array(':hide', 'guests', 'cssID', 'space'), 'invisible' => array(':hide', 'invisible', 'start', 'stop'));
// bootstrap empty palettes
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['_bootstrap_empty_'] = array('type' => array('type'));
// Bootstrap parent palette.
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_parent extends _bootstrap_empty_'] = array('+type' => array('bootstrap_parentId'));
// wrapper elements
$GLOBALS['TL_DCA']['tl_content']['config']['ondelete_callback'][] = array('Netzmacht\\Bootstrap\\Core\\Contao\\DataContainer\\Wrapper', 'delete');
$GLOBALS['TL_DCA']['tl_content']['fields']['type']['save_callback'][] = array('Netzmacht\\Bootstrap\\Core\\Contao\\DataContainer\\Wrapper', 'save');
// fields
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_parentId'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_parentId'], 'inputType' => 'select', 'options_callback' => array('Netzmacht\\Bootstrap\\Core\\Contao\\DataContainer\\Wrapper', 'getParents'), 'eval' => array('includeBlankOption' => true, 'mandatory' => true, 'doNotCopy' => true), 'sql' => "int(10) unsigned NULL");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_icon'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_icon'], 'exclude' => true, 'inputType' => 'icon', 'options' => \Netzmacht\Bootstrap\Core\Bootstrap::getIconSet()->getIcons(), 'reference' => &$GLOBALS['TL_LANG']['tl_content'], 'eval' => array('tl_class' => 'w50', 'iconTemplate' => \Netzmacht\Bootstrap\Core\Bootstrap::getIconSet()->getTemplate()), 'sql' => "varchar(32) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_dataAttributes'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_dataAttributes'], 'exclude' => true, 'inputType' => 'multiColumnWizard', 'eval' => array('tl_class' => 'clr', 'columnFields' => array('name' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_dataAttributes_name'], 'exclude' => true, 'inputType' => 'select', 'options' => \Netzmacht\Bootstrap\Core\Bootstrap::getConfigVar('form.data-attributes', array()), 'reference' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_types'], 'eval' => array('style' => 'width: 145px;', 'includeBlankOption' => true, 'chosen' => true)), 'value' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_dataAttributes_value'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('style' => 'width: 160px', 'allowHtml' => true)))), 'sql' => "blob NULL");
Example #21
0
 /**
  * Append modals to the html body.
  *
  * @param string $buffer Frontend template output buffer.
  *
  * @return string
  */
 public function appendModals($buffer)
 {
     $modals = implode('', Bootstrap::getConfigVar('runtime.modals', array()));
     $modals = str_replace(array('{{request_token}}', '[{]', '[}]'), array(REQUEST_TOKEN, '{{', '}}'), $modals);
     return str_replace('</body>', $modals . '</body>', $buffer);
 }
Example #22
0
/**
 * @package    contao-bootstrap
 * @author     David Molineus <*****@*****.**>
 * @copyright  2014-2015 netzmacht creative David Molineus
 * @license    LGPL 3.0
 * @filesource
 *
 */
/*
 * Palettes
 */
$GLOBALS['TL_DCA']['tl_layout']['metasubselectpalettes']['bootstrap_containerElement']['!'] = array('bootstrap_containerClass');
/**
 * fields
 */
$GLOBALS['TL_DCA']['tl_layout']['fields']['name']['eval']['tl_class'] = 'w50';
// use template loader which shows list of safe and unsafe templates
$GLOBALS['TL_DCA']['tl_layout']['fields']['template']['reference'] = $GLOBALS['TL_LANG']['tl_layout'];
$GLOBALS['TL_DCA']['tl_layout']['fields']['template']['options_callback'] = array('Netzmacht\\Bootstrap\\Core\\Contao\\DataContainer\\Module', 'getTemplates');
$GLOBALS['TL_DCA']['tl_layout']['fields']['template']['eval'] = array('templatePrefix' => 'fe_', 'templateThemeId' => 'pid');
// do not import layout builder by default to prevent side effects
$GLOBALS['TL_DCA']['tl_layout']['fields']['framework']['default'] = array();
$GLOBALS['TL_DCA']['tl_layout']['fields']['layoutType']['save_callback'][] = array('Netzmacht\\Bootstrap\\Layout\\Contao\\DataContainer\\Layout', 'disableFramework');
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_headerClass'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_headerClass'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(150) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_footerClass'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_footerClass'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(150) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_mainClass'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_mainClass'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(150) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_leftClass'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_leftClass'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(150) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_rightClass'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_rightClass'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(150) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_layout']['fields']['viewport'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['viewport'], 'exclude' => true, 'default' => \Netzmacht\Bootstrap\Core\Bootstrap::getConfigVar('layout.viewport', ''), 'inputType' => 'text', 'eval' => array('tl_class' => 'w50', 'decodeEntities' => true), 'sql' => "varchar(255) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_containerElement'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_containerElement'], 'exclude' => true, 'inputType' => 'select', 'options' => array('container', 'wrapper'), 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'submitOnChange' => true), 'sql' => "varchar(10) NOT NULL default 'container'");
$GLOBALS['TL_DCA']['tl_layout']['fields']['bootstrap_containerClass'] = array('label' => &$GLOBALS['TL_LANG']['tl_layout']['bootstrap_containerClass'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(128) NOT NULL default 'container'");
Example #23
0
 /**
  * Select an icon set.
  *
  * @return void
  */
 protected function selectIconSet()
 {
     $config = Bootstrap::getConfig();
     $iconSet = Bootstrap::getIconSet();
     $active = $config->get('icons.active');
     $template = $config->get(sprintf('icons.sets.%s.template', $active));
     $path = $config->get(sprintf('icons.sets.%s.path', $active));
     if ($active && $path && file_exists(TL_ROOT . '/' . $path)) {
         $icons = (include TL_ROOT . '/' . $path);
         $iconSet->setIconSetName($active)->setIcons($icons)->setTemplate($template);
     }
     $this->addIconStylesheet();
 }
 /**
  * Get column numbers.
  *
  * @param \DataContainer $dataContainer Data container driver.
  *
  * @return array
  */
 public function getColumnNumbers($dataContainer)
 {
     if ($dataContainer->activeRecord) {
         $columns = $dataContainer->activeRecord->columns;
     } else {
         $columns = Bootstrap::getConfigVar('grid-editor.columns');
     }
     $values = range(1, $columns);
     return $values;
 }
 /**
  * {@inheritdoc}
  */
 public function getDropdownToggle()
 {
     return Bootstrap::getConfigVar('dropdown.toggle');
 }
Example #26
0
 /**
  * Replace deprecated insert tag.
  *
  * @param ReplaceInsertTagsEvent $event  Replace insert tag event.
  * @param array                  $params Insert tag params.
  * @param int                    $count  Number of params.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 private function replaceDeprecatedInsertTag(ReplaceInsertTagsEvent $event, $params, $count)
 {
     if (($count == 4 || $count == 5) && in_array($params[0], array('url', 'link', 'remote'))) {
         $params[0] = $GLOBALS['objPage']->id;
         $buffer = vsprintf(Bootstrap::getConfigVar('modal.remoteDynamicUrl'), $params);
         if ($params[0] === 'link' && $count === 4) {
             $model = \ModuleModel::findByPk($params[1]);
             if ($model === null || $model->type != 'bootstrap_modal') {
                 return;
             }
             $params[6] = $model->name;
             $cssId = deserialize($model->cssID, true);
             $cssId = '#' . ($cssId[0] != '' ? $cssId[0] : 'modal-' . $model->id);
             $buffer = sprintf('<a href="%s" data-toggle="modal" data-target="%s">%s</a>', $buffer, $cssId, $params[6]);
         }
         $event->setHtml($buffer);
     }
 }
 /**
  * ParseTemplate hook being used to beatify the backend view.
  *
  * @param \Template $template The template.
  *
  * @return void
  */
 public function hookParseTemplate(\Template $template)
 {
     if (TL_MODE == 'BE' && $template->getName() == 'be_subcolumns' && Bootstrap::getConfigVar('grid-editor.backend.replace-subcolumns-template')) {
         $template->setName('be_subcolumns_bootstrap');
     }
 }
Example #28
0
 /**
  * Get modal content.
  *
  * @return string
  */
 private function getContent()
 {
     $config = Bootstrap::getConfig();
     switch ($this->bootstrap_modalContentType) {
         case 'article':
             return $this->getArticle($this->bootstrap_article, false, true);
         case 'form':
             return $this->generateForm($config);
         case 'module':
             return $this->getFrontendModule($this->bootstrap_module);
         case 'html':
             return TL_MODE == 'FE' ? $this->html : htmlspecialchars($this->bootstrap_html);
         case 'template':
             ob_start();
             include $this->getTemplate($this->bootstrap_modalTemplate);
             $buffer = ob_get_contents();
             ob_end_clean();
             return $buffer;
         case 'text':
             return \String::toHtml5($this->bootstrap_text);
         default:
             return '';
     }
 }
Example #29
0
 /**
  * Compile tabs.
  *
  * @return void
  */
 protected function compile()
 {
     $this->Template->tabs = $this->tabs;
     $this->Template->currentTab = $this->currentTab;
     $this->Template->toggle = Bootstrap::getConfigVar('dropdown.toggle');
 }
Example #30
0
 /**
  * Get page layout.
  *
  * @return \LayoutModel|null
  */
 public static function getPageLayout()
 {
     return Bootstrap::getPageLayout();
 }