public function headline() { if (!$this->readonly) { /* $fieldName = $this->name; $blueprint = $this->page()->blueprint(); $fieldsets = $blueprint->fields($this)->$fieldName->fieldsets;*/ $fieldsets = $this->fieldsets(); $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-chevron-circle-down"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->data('modal', true); $dropDown = new Brick("div"); $dropDown->addClass('builder-drop-down'); $addList = new Brick('ul'); $addList->addClass('builder-add-list'); foreach ($fieldsets as $fieldsetName => $fieldsetFields) { $addListItem = new Brick('li'); $addListItemLink = new Brick('a'); $addListItemLink->html('<i class="icon icon-left fa fa-plus-circle"></i>' . $fieldsetFields['label']); $addListItemLink->addClass('builder-add-button'); $addListItemLink->data('modal', true); $addListItemLink->attr('href', purl($this->page, 'field/' . $this->name . '/builder/add?fieldset=' . $fieldsetName)); $addListItem->append($addListItemLink); $addList->append($addListItem); } $dropDown->append($addList); } else { $addList = null; $add = null; } $label = BaseField::label(); $label->append($add); $label->append($dropDown); return $label; }
public function headline() { $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-plus-circle"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->attr('#'); $label = parent::label(); $label->addClass('structure-label'); $label->append($add); return $label; }
public function counter() { if (!$this->minLength() && !$this->maxLength() || $this->readonly()) { return null; } $counter = new Brick('div'); $counter->addClass('field-counter marginalia text'); $length = str::length(trim($this->value())); if ($this->outsideRange($length)) { $counter->addClass('outside-range'); } $counter->data('field', 'counter'); $counter->html($length . ($this->maxLength() ? '/' . $this->maxLength() : '')); return $counter; }
/** * Generate field content markup * * @return string */ public function content() { $wrapper = new Brick('div'); $wrapper->addClass('subpagelist'); $children = $this->subpages(); // add pagination to the subpages $limit = $this->limit() ? $this->limit() : 10000; $children = $children->paginate($limit, array('page' => get('page'))); // use existing snippet to build the list // @see panel/app/controllers/views/pages.php $subpages = new Snippet('pages/sidebar/subpages', array('title' => l('pages.show.subpages.title'), 'page' => $this->page(), 'subpages' => $children, 'addbutton' => !api::maxPages($this, $this->subpages()->max()), 'pagination' => $children->pagination())); // use template with defined vars $wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('subpages' => $subpages))); return $wrapper; }
/** * Generate field content markup * * @return string */ public function content() { $wrapper = new Brick('div'); $wrapper->addClass('subpagelist'); $children = $this->subpages(); // add pagination to the subpages $limit = $this->limit() ? $this->limit() : 10000; $children = $children->paginated('sidebar'); $pagination = new Snippet('pagination', array('pagination' => $children->pagination(), 'nextUrl' => $children->pagination()->nextPageUrl(), 'prevUrl' => $children->pagination()->prevPageUrl())); // use existing snippet to build the list // @see /panel/app/src/panel/models/page/sidebar.php $subpages = new Snippet('pages/sidebar/subpages', array('title' => $this->i18n($this->label), 'page' => $this->page(), 'subpages' => $children, 'addbutton' => $this->page->addButton(), 'pagination' => $pagination)); // use template with defined vars $wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('subpages' => $subpages))); return $wrapper; }
public function headline() { if (!$this->readonly) { $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-plus-circle"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->data('modal', true); $add->attr('href', purl($this->model, 'field/' . $this->name . '/structure/add')); } else { $add = null; } $label = parent::label(); $label->addClass('structure-label'); $label->append($add); return $label; }
public function input() { $input = new Brick('input', null); $input->addClass('input'); $input->attr(array('type' => $this->type(), 'value' => '', 'required' => $this->required(), 'name' => $this->name(), 'autocomplete' => $this->autocomplete() === false ? 'off' : 'on', 'autofocus' => $this->autofocus(), 'placeholder' => $this->i18n($this->placeholder()), 'readonly' => $this->readonly(), 'disabled' => $this->disabled(), 'id' => $this->id())); $input->tag('textarea'); $input->removeAttr('type'); $input->removeAttr('value'); $input->data('field', 'editor'); $input->html('{{yamlvalues}}' ?: false); if (!is_array($this->value())) { $input->val('{{yamlvalues}}'); } if ($this->readonly()) { $input->attr('tabindex', '-1'); $input->addClass('input-is-readonly'); } return $input; }
public function alert($alert = null) { if (!is_null($alert)) { $this->alert = $alert; return $this; } if (is_null($this->alert)) { return null; } $message = $this->alert; $alert = new Brick('div'); $alert->addClass('message message-is-alert'); $alert->append(function () use($message) { $content = new Brick('span'); $content->addClass('message-content'); $content->text($message); return $content; }); $alert->append(function () { $toggle = new Brick('span'); $toggle->addClass('message-toggle'); $toggle->html('<i>×</i>'); return $toggle; }); return $alert; }
/** * Create editor element * * This creates our main editor <div>. * * @since 1.0.0 * * @return \Brick */ protected function editor() { /* Prepare editor element */ $editor = new Brick('div'); $editor->addClass('input'); $editor->addClass('wysiwyg-editor'); $editor->attr('id', $this->id() . '-editor'); $editor->data(array('storage' => $this->id(), 'buttons' => implode(',', $this->buttons), 'double-returns' => $this->doubleReturns, 'dragdrop-medium' => $this->mediumDragDrop)); /* Parse markdown and set editor content */ $editor->html($this->convertToHtml($this->value() ?: '')); return $editor; }
/** * Generate field content markup * * @since 1.0.0 * * @return string */ public function content() { $wrapper = new Brick('div'); $wrapper->addClass('selector'); $wrapper->data(array('field' => 'selector', 'name' => $this->name(), 'page' => $this->page(), 'mode' => $this->mode, 'autoselect' => $this->autoselect())); $wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('field' => $this))); return $wrapper; }
public function help() { if (!$this->help) { return null; } $help = new Brick('div'); $help->addClass('field-help marginalia text'); $help->html($this->i18n($this->help)); return $help; }
/** * Generate field content markup * * @since 1.0.0 * * @return string */ public function content() { /* Zusätzliche Textspalten */ $additional_columns = yaml($this->page()->columns()); $additional_columns = reset($additional_columns); /* Bildbeschnitt, falls vorhanden */ $image_crop = $this->page()->image_crop() != "" ? $this->page()->image_crop() : ""; $wrapper = new Brick('div'); $wrapper->addClass('layoutswitcher'); $wrapper->data(array('field' => 'layoutswitcher', 'name' => $this->name(), 'page' => $this->page())); $wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('field' => $this, 'text1' => $this->page()->text(), 'text2' => $additional_columns["text2"], 'text3' => $additional_columns["text3"], 'noc' => intval($additional_columns["noc"]), 'crop' => $image_crop, 'page_tpl' => $this->page()->intendedTemplate()))); return $wrapper; }
public function headline() { // get entries $entries = $this->entries(); // check if limit is either null or the number of entries less than limit if (!$this->readonly && (is_null($this->limit) || is_int($this->limit) && $entries->count() < $this->limit)) { $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-plus-circle"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->data('modal', true); $add->attr('href', purl($this->model, 'field/' . $this->name . '/structure/add')); } else { $add = null; } // make sure there's at least an empty label if (!$this->label) { $this->label = ' '; } $label = parent::label(); $label->addClass('structure-label'); $label->append($add); return $label; }