Ejemplo n.º 1
0
 /**
  * compile button element, inspired by ContentHyperlink
  */
 protected function compile()
 {
     if (substr($this->url, 0, 7) == 'mailto:') {
         $this->url = \String::encodeEmail($this->url);
     } else {
         $this->url = ampersand($this->url);
     }
     if ($this->linkTitle == '') {
         $this->linkTitle = $this->url;
     }
     if (strncmp($this->rel, 'lightbox', 8) !== 0) {
         $this->Template->attribute = ' rel="' . $this->rel . '"';
     } else {
         $this->Template->attribute = ' data-lightbox="' . substr($this->rel, 9, -1) . '"';
     }
     // Override the link target
     if ($this->target) {
         $this->Template->target = ' target="_blank"';
     }
     if ($this->cssID[1] == '') {
         $cssID = $this->cssID;
         $cssID[1] = 'btn-default';
         $this->cssID = $cssID;
     }
     if ($this->icon) {
         $this->Template->icon = Icons::generateIcon($this->icon);
     }
     // add data attributes
     $this->dataAttributes = deserialize($this->dataAttributes, true);
     if (!empty($this->dataAttributes)) {
         $attributes = array();
         foreach ($this->dataAttributes as $attribute) {
             if (trim($attribute['value']) != '' && $attribute['name'] != '') {
                 $attributes[] = 'data-' . $attribute['name'] . '=' . $attribute['value'];
             }
         }
         $this->Template->attribute = trim($this->attribute . ' ' . implode(' ', $attributes));
     }
     $this->Template->rel = $this->rel;
     // Backwards compatibility
     $this->Template->href = $this->url;
     $this->Template->link = $this->linkTitle;
     $this->Template->linkTitle = specialchars($this->titleText ?: $this->linkTitle);
 }
Ejemplo n.º 2
0
 /**
  * Generate the widget and return it as string
  * @return string
  */
 public function generate()
 {
     if ($this->imageSubmit) {
         $objModel = \FilesModel::findByPk($this->singleSRC);
         if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
             return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s" title="%s" alt="%s"%s>%s</button>', $this->strId, $this->strClass != '' ? ' ' . $this->strClass : 'btn-default', specialchars($this->slabel), specialchars($this->slabel), $this->getAttributes(), \Image::getHtml($objModel->path, $this->slabel));
         }
     }
     $label = specialchars($this->slabel);
     if ($this->bootstrap_addIcon) {
         $icon = Icons::generateIcon($this->bootstrap_icon);
         if ($this->bootstrap_iconPosition == 'right') {
             $label = $label . ' ' . $icon;
         } else {
             $label = $icon . ' ' . $label;
         }
     }
     // Return the regular button
     return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s"%s>%s</button>', $this->strId, $this->strClass != '' ? $this->strClass : 'btn-default', $this->getAttributes(), $label);
 }
Ejemplo n.º 3
0
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_carouselEnd extends _typeOnly_'] = array();
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_carouselStart extends _typeOnly_'] = array('config' => array('bootstrap_showIndicators', 'bootstrap_showControls', 'bootstrap_autostart', 'bootstrap_interval'), 'expert' => array(':hide', 'guests', 'cssID', 'space'), 'invisible' => array(':hide', 'invisible', 'start', 'stop'));
// bootstrap tabs palette
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_tabPart extends _typeOnly_'] = array();
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_tabEnd extends _typeOnly_'] = array();
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_tabStart extends _typeOnly_'] = array('config' => array('bootstrap_tabs', 'bootstrap_fade'), 'expert' => array(':hide', 'guests', 'cssID', 'space'), 'invisible' => array(':hide', 'invisible', 'start', 'stop'));
// boostrap columnset palettes
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_columnset extends _bootstrap_'] = array('config' => array('sc_type', 'bootstrap_articleMarkup'));
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['bootstrap_buttons extends _bootstrap_'] = array('config' => array('bootstrap_buttons', 'bootstrap_buttonStyle'));
/**
 * sub select palettes
 */
$GLOBALS['TL_DCA']['tl_content']['metasubselectpalettes']['sc_type']['!'] = array('bootstrap_columnset');
/**
 * fields
 */
$GLOBALS['TL_DCA']['tl_content']['fields']['type']['save_callback'][] = array('Netzmacht\\Bootstrap\\DataContainer\\Wrapper', 'save');
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_articleMarkup'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_articleMarkup'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50', 'style' => 'clear: both;'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_buttonStyle'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttonStyle'], 'exclude' => true, 'inputType' => 'text', 'reference' => &$GLOBALS['TL_LANG']['tl_content'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(128) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_icon'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_icon'], 'exclude' => true, 'inputType' => 'icon', 'options' => \Netzmacht\Bootstrap\Helper\Icons::getIcons(), 'reference' => &$GLOBALS['TL_LANG']['tl_content'], 'eval' => array('tl_class' => 'w50', 'iconTemplate' => \Netzmacht\Bootstrap\Helper\Icons::getIconTemplate()), 'sql' => "varchar(32) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_columnset'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_columnset'], 'exclude' => true, 'inputType' => 'multiColumnWizard', 'eval' => array('columnFields' => array('article' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_columnset_article'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('Netzmacht\\Bootstrap\\DataContainer\\Content', 'getPageBootstrapArticles'), 'eval' => array('style' => 'width:450px', 'includeBlankOption' => true, 'chosen' => true))), 'buttons' => array('copy' => false, 'delete' => false), 'tl_class' => '" style="clear:both;'), 'sql' => "blob NULL");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_showIndicators'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_showIndicators'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'm12 w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_showControls'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_showControls'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_autostart'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_autostart'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_interval'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_interval'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('tl_class' => 'clr'), 'sql' => "int(10) unsigned NOT NULL default '0'");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_subType'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_subType'], 'exclude' => true, 'inputType' => 'radio', 'options' => array('start', 'part', 'end'), 'reference' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_subType'], 'eval' => array('tl_class' => 'clr', 'submitOnChange' => true), 'sql' => "varchar(5) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_tabs'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_tabs'], 'exclude' => true, 'inputType' => 'multiColumnWizard', 'eval' => array('tl_class' => 'clr', 'submitOnChange' => true, 'columnFields' => array('title' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_tabs_title'], 'exclude' => true, 'inputType' => 'text', 'eval' => array()), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_tabs_type'], 'exclude' => true, 'inputType' => 'select', 'options' => array('dropdown', 'child'), 'reference' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_tabs_type'], 'eval' => array('includeBlankOption' => true, 'style' => 'width: 140px;')))), 'sql' => "blob NULL");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_fade'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_fade'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_parentId'] = array('sql' => "int(10) unsigned NULL");
$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_buttons'] = array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons'], 'exclude' => true, 'inputType' => 'multiColumnWizard', 'eval' => array('tl_class' => 'bootstrapMultiColumnWizard hideSubLabels', 'decodeEntities' => true, 'columnFields' => array('type' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_type'], 'exclude' => true, 'inputType' => 'select', 'options' => array('link', 'group', 'dropdown', 'child', 'header'), 'reference' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_types'], 'eval' => array('style' => 'width: 90px;', 'valign' => 'top')), 'label' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_label'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('style' => 'width: 90px', 'valign' => 'top', 'allowHtml' => true)), 'url' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_url'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('style' => 'width: 90px', 'valign' => 'top', 'rgxp' => 'url', 'decodeEntities' => true, 'tl_class' => 'wizard'), 'wizard' => array(array('Netzmacht\\Bootstrap\\DataContainer\\Module', 'pagePicker'))), 'attributes' => array('label' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_attributes'], 'exclude' => true, 'inputType' => 'multiColumnWizard', 'options' => array('data-dismiss="modal"', 'class="btn-default"'), 'eval' => array('decodeEntities' => true, 'columnFields' => array('name' => array('inputType' => 'text', 'options' => array('class', 'title', 'data-'), 'exclude' => true, 'eval' => array('includeBlankOption' => true, 'style' => 'width: 130px;', 'placeholder' => $GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_attributes_name'])), 'value' => array('inputType' => 'text', 'exclude' => true, 'eval' => array('style' => 'width: 80px', 'placeholder' => $GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_attributes_value']))))))), 'sql' => "blob NULL");
$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' => $GLOBALS['BOOTSTRAP']['form']['dataAttributes'], 'reference' => &$GLOBALS['TL_LANG']['tl_content']['bootstrap_buttons_types'], 'eval' => array('style' => 'width: 145px;', 'includeBlankOption' => 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");
Ejemplo n.º 4
0
 /**
  * generate an icon using insert tag
  *
  * icon::example
  * icon::exmaple::extra-css-class
  *
  * @param $tag
  *
  * @return bool|string
  */
 protected function icon($parts, $cache)
 {
     return Icons::generateIcon($parts[0], isset($parts[1]) ? $parts[1] : null);
 }
Ejemplo n.º 5
0
 /**
  * @param $container
  * @param $widget
  * @param $inputGroup
  */
 private function adjustSubmitButton(Container $container, $widget, InputGroup $inputGroup)
 {
     if ($container->hasChild('submit')) {
         /** @var Node $submit */
         $submit = $container->removeChild('submit');
         // recreate as button
         if ($submit->getTag() != 'button') {
             $submit = Element::create('button');
             $submit->setAttribute('type', 'submit');
             $submit->addChild($widget->slabel);
         }
         $submit->addClass('btn');
         if ($widget->bootstrap_addSubmitClass) {
             $submit->addClass($widget->bootstrap_addSubmitClass);
         }
         if ($widget->bootstrap_addSubmitIcon) {
             $icon = Icons::generateIcon($widget->bootstrap_addSubmitIcon);
             $position = null;
             if ($widget->bootstrap_addSubmitIconPosition == 'left') {
                 $position = Node::POSITION_FIRST;
                 $icon .= ' ';
             } else {
                 $icon = ' ' . $icon;
             }
             $submit->addChild(new StaticHtml($icon), $position);
         }
         $inputGroup->setRight($submit, $inputGroup::BUTTON);
     }
 }