Beispiel #1
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());
 }
Beispiel #2
0
 /**
  * compile
  */
 protected function compile()
 {
     if ($this->cssID[0] == '') {
         $cssID = $this->cssID;
         $cssID[0] = 'modal-' . $this->id;
         $this->cssID = $cssID;
     }
     $modal = new Component();
     $modal->setId($this->cssID[0])->setSize($this->bootstrap_modalSize);
     if ($this->cssID[1]) {
         $modal->addClass($this->cssID[1]);
     }
     // check if ajax is used
     if ($this->bootstrap_modalAjax) {
         $this->Template->hideFrame = $this->isAjax;
         $this->Template->hideContent = !$this->Template->hideFrame;
     }
     if ($this->Template->hideContent) {
         $url = \Controller::generateFrontendUrl($GLOBALS['objPage']->row()) . '?bootstrap_modal=' . $this->id;
         //$url = sprintf(Bootstrap::getConfigVar('modal.remoteUrl'), $GLOBALS['objPage']->id, $this->id);
         $modal->setAttribute('data-remote', $url)->render($this->Template);
         return;
     }
     if ($this->headline) {
         $headline = Element::create($this->hl)->addClass('modal-title')->addChild($this->headline);
         $modal->setTitle($headline);
     }
     $modal->setContent($this->getContent())->setFooter($this->getButtons())->setCloseButton(Bootstrap::getConfigVar('modal.dismiss'), true)->render($this->Template);
 }
Beispiel #3
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'));
     }
 }
Beispiel #4
0
 /**
  * Compile the module.
  *
  * @return void
  */
 protected function compile()
 {
     if ($this->cssID[0] == '') {
         $cssID = $this->cssID;
         $cssID[0] = 'modal-' . $this->id;
         $this->cssID = $cssID;
     }
     $modal = new Component();
     $modal->setId($this->cssID[0])->setSize($this->bootstrap_modalSize)->setAttribute('role', 'dialog')->setAttribute('aria-hidden', 'true')->setAttribute('taxindex', '-1');
     if ($this->cssID[1]) {
         $modal->addClass($this->cssID[1]);
     }
     // check if ajax is used
     if ($this->bootstrap_modalAjax) {
         $this->Template->hideFrame = $this->isAjax;
         $this->Template->hideContent = !$this->Template->hideFrame;
     }
     if ($this->Template->hideContent) {
         $modal->render($this->Template);
         return;
     }
     if ($this->headline) {
         $headline = Element::create($this->hl)->addClass('modal-title')->addChild($this->headline);
         $modal->setTitle($headline);
     }
     $modal->setContent($this->getContent())->setFooter($this->getButtons())->setCloseButton(Bootstrap::getConfigVar('modal.dismiss'), true)->render($this->Template);
 }
 /**
  * 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);
     }
 }
Beispiel #6
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;
 }
Beispiel #7
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;
     }
 }
Beispiel #8
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;
 }
Beispiel #9
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;
 }
Beispiel #10
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;
 }
 /**
  * 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;
 }
Beispiel #12
0
 /**
  * Add icon stylesheet to the backend template.
  *
  * @return void
  */
 public function addIconStylesheet()
 {
     if (TL_MODE == 'BE') {
         $active = Bootstrap::getConfigVar('icons.active');
         $css = Bootstrap::getConfigVar(sprintf('icons.sets.%s.stylesheet', $active));
         AssetsManager::addStylesheets($css, 'bootstrap-icon-set');
     }
 }
Beispiel #13
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);
 }
 /**
  * Get dropdown templates.
  *
  * @return array
  */
 public function getDropdownTemplates()
 {
     return Bootstrap::getConfigVar('config.options.dropdown.formless', array());
 }
 /**
  * {@inheritdoc}
  */
 public function getDropdownToggle()
 {
     return Bootstrap::getConfigVar('dropdown.toggle');
 }
Beispiel #16
0
 /**
  * Get current accordion group.
  *
  * @return string
  */
 public static function getGroup()
 {
     return Bootstrap::getConfigVar('runtime.accordion-group');
 }
Beispiel #17
0
 /**
  * @param \Widget $widget
  * @return bool
  */
 protected function isPartOfModalFooter(\Widget $widget)
 {
     $isModal = Bootstrap::getConfigVar('runtime.modal-footer') !== false && Bootstrap::getConfigVar('modal.adjustForm') && Bootstrap::getConfigVar(sprintf('form.widgets.%s.modal-footer', $widget->type));
     return $isModal;
 }
Beispiel #18
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'");
Beispiel #19
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");
Beispiel #20
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);
 }
Beispiel #21
0
 /**
  * Create separator elements.
  *
  * @param Helper           $wrapper Wrapper helper.
  * @param \Database\Result $record  Database result.
  * @param int              $sorting Sorting index.
  *
  * @return array|int
  */
 private function createSeparators($wrapper, $record, $sorting)
 {
     $config = Bootstrap::getConfigVar(sprintf('wrappers.%s.%s', $wrapper->getGroup(), Helper::TYPE_SEPARATOR));
     $callback = $config['count-existing'];
     $instance = \Controller::importStatic($callback[0]);
     $existing = $instance->{$callback}[1]($record, $wrapper);
     $callback = $config['count-required'];
     $instance = \Controller::importStatic($callback[0]);
     $required = $instance->{$callback}[1]($record, $wrapper);
     if ($existing < $required) {
         if ($this->isTrigger($wrapper->getType(), Helper::TYPE_SEPARATOR)) {
             $count = $required - $existing;
             for ($i = 0; $i < $count; $i++) {
                 $this->createElement($record, $sorting, Helper::TYPE_SEPARATOR);
             }
             $end = $wrapper->findRelatedElement(Helper::TYPE_STOP);
             if ($end && $end->sorting <= $sorting) {
                 $sorting = $sorting + 2;
                 $end->sorting = $sorting;
                 $end->save();
                 return array($sorting, $end);
             }
         }
     } elseif ($required < $existing) {
         if ($this->isTrigger($wrapper->getType(), Helper::TYPE_SEPARATOR, static::TRIGGER_DELETE)) {
             $count = $existing - $required;
             $parentId = $wrapper->isTypeOf(Helper::TYPE_START) ? $record->id : $record->bootstrap_parentId;
             \Database::getInstance()->prepare('DELETE FROM tl_content WHERE bootstrap_parentId=? AND type=? ORDER BY sorting DESC')->limit($count)->execute($parentId, $wrapper->getTypeName(Helper::TYPE_SEPARATOR));
         }
     }
     return $sorting;
 }
Beispiel #22
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);
         }
     }
 }
Beispiel #23
0
 /**
  * Initialize
  */
 private function initialize()
 {
     $level = substr($this->template->level, 6);
     $attributes = $this->listAttributes;
     $attributes->addClass($this->template->level);
     switch ($level) {
         case '1':
             $class = Bootstrap::getConfigVar('runtime.nav-class');
             if ($class) {
                 $attributes->addClass('nav');
                 $attributes->addClass($class);
                 Bootstrap::setConfigVar('runtime.nav-class', '');
             }
             break;
         case '2':
             $attributes->addClass('dropdown-menu');
             break;
         default:
             $attributes->addClass('dropdown-menu')->addClass('collapse');
             break;
     }
     if ($level > 1) {
         $disableChildrenList = !($this->template->items && ($level != 1 && $level % 2 == 1));
         $this->setChildrenList($disableChildrenList);
     }
 }
 /**
  * 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');
     }
 }
Beispiel #25
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);
     }
 }
Beispiel #26
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');
 }
Beispiel #27
0
use Bit3\Contao\MetaPalettes\MetaPalettes;
/*
 * Palettes
 */
$GLOBALS['TL_DCA']['tl_form_field']['metapalettes']['button'] = array('type' => array('type', 'name', 'slabel', 'bootstrap_addIcon'), 'image' => array(':hide', 'imageSubmit'), 'expert' => array(':hide', 'class', 'accesskey', 'tabindex'), 'template' => array(':hide,customTpl'));
foreach (Bootstrap::getConfigVar('form.widgets', array()) as $widget => $config) {
    if (isset($config['input-group']) && $config['input-group']) {
        MetaPalettes::appendAfter('tl_form_field', $widget, 'fconfig', array('icon' => array(':hide', 'bootstrap_addIcon'), 'unit' => array(':hide', 'bootstrap_addUnit')));
    }
}
// append inlineStyle option to radio and checkbox
MetaPalettes::appendFields('tl_form_field', 'radio', 'fconfig', array('bootstrap_inlineStyle'));
MetaPalettes::appendFields('tl_form_field', 'checkbox', 'fconfig', array('bootstrap_inlineStyle'));
// Add search select option
MetaPalettes::appendFields('tl_form_field', 'select', 'fconfig', array('bootstrap_select_search'));
if (Bootstrap::getConfigVar('form.styled-upload.enabled')) {
    MetaPalettes::appendFields('tl_form_field', 'upload', 'fconfig', array('placeholder'));
}
$GLOBALS['TL_DCA']['tl_form_field']['metasubpalettes']['bootstrap_addIcon'] = array('bootstrap_icon', 'bootstrap_iconPosition');
$GLOBALS['TL_DCA']['tl_form_field']['metasubpalettes']['bootstrap_addUnit'] = array('bootstrap_unit', 'bootstrap_unitPosition');
unset($GLOBALS['TL_DCA']['tl_form_field']['subpalettes']['addSubmit']);
$GLOBALS['TL_DCA']['tl_form_field']['metasubpalettes']['addSubmit'] = array('slabel', 'bootstrap_addSubmitIcon', 'bootstrap_addSubmitIconPosition', 'bootstrap_addSubmitClass');
/*
 * Fields
 */
$GLOBALS['TL_DCA']['tl_form_field']['fields']['type']['options_callback'] = function () {
    return array_keys($GLOBALS['TL_FFL']);
};
$GLOBALS['TL_DCA']['tl_form_field']['fields']['bootstrap_addIcon'] = array('label' => &$GLOBALS['TL_LANG']['tl_form_field']['bootstrap_addIcon'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_form_field']['fields']['bootstrap_icon'] = array('label' => &$GLOBALS['TL_LANG']['tl_form_field']['bootstrap_icon'], 'exclude' => true, 'inputType' => 'icon', 'options' => Bootstrap::getIconSet()->getIcons(), 'eval' => array('tl_class' => 'w50', 'iconTemplate' => Bootstrap::getIconSet()->getTemplate()), 'sql' => "varchar(32) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_form_field']['fields']['bootstrap_iconPosition'] = array('label' => &$GLOBALS['TL_LANG']['tl_form_field']['bootstrap_iconPosition'], 'exclude' => true, 'inputType' => 'select', 'options' => array('left', 'right'), 'reference' => &$GLOBALS['TL_LANG']['tl_form_field'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''");