public function template() { $wrapper = new Brick('div', null); $wrapper->data('tab-name', $this->i18n($this->label)); $wrapper->data('field', 'tabs'); $wrapper->addClass('tab-placeholder'); return $wrapper; }
public function content() { $relation = new Brick('div'); $relation->addClass('input input-display'); if ($this->readonly()) { $relation->addClass('input-is-readonly'); } $relation->data(array('field' => 'relation', 'search' => $this->search ? 1 : 0, 'readonly' => ($this->readonly or $this->disabled) ? 1 : 0)); $relation->append('<div class="placeholder"> </div>'); $content = new Brick('div'); $content->addClass('field-content input-with-relationbox'); $content->append($relation); // list with options $html = '<div class="input-list">'; if ($this->search) { $html .= '<input class="relationbox-search" placeholder="Type to filter options">'; } $html .= '<ul>'; foreach ($this->options() as $key => $value) { $html .= '<li class="input-list-item">'; $html .= $this->item($key, $value); $html .= '</li>'; } $html .= '</ul>'; $html .= '</div>'; $content->append($html); $content->append($this->icon()); return $content; }
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 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; }
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 content() { $multiselect = new Brick('div'); $multiselect->addClass('input input-display'); if ($this->readonly()) { $multiselect->addClass('input-is-readonly'); } $multiselect->attr(array('tabindex' => 0)); $multiselect->data(array('field' => 'multiselect', 'search' => $this->search ? 1 : 0, 'readonly' => ($this->readonly or $this->disabled) ? 1 : 0)); $multiselect->append('<div class="placeholder"> </div>'); $content = new Brick('div'); $content->addClass('field-content input-with-multiselectbox'); $content->append($multiselect); $content->append($this->optionlist()); $content->append($this->icon()); return $content; }
public function input() { $color = new Brick('input'); $color->addClass('colorpicker'); $color->data('field', 'minicolors'); if ($this->value() == "" && $this->default() !== "") { $value = $this->default(); } elseif ($this->value() == "" && $this->default() == "") { $value = ""; } else { $value = $this->value(); } $color->attr(array('name' => $this->name(), 'id' => $this->id(), 'type' => "text", 'data-defaultvalue' => $value, 'value' => $value)); $color->append($this->option('', '', $this->value() == '')); $wrapper = new Brick('div'); $wrapper->addClass('input color-wrapper'); $wrapper->append($color); return $color; }
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; }
/** * 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; }
/** * Get a link that allows to delete the comment. Only available to registered * users. * * @return Brick|string */ public function deleteLink() { // Ensure the current user is allowed to edit the comment if (!$this->exists || !$this->currentUserCan('delete')) { return ''; } $uri = $this->page()->uri(); $hash = $this->page()->hash(); $id = $this->id(); $link = new Brick('a'); $link->attr('href', $this->actionUrl('delete')); $link->data('href', $this->actionUrl('delete', true)); $link->addClass('comment-delete-link js-delete'); $link->text(l('comments.comment.delete', 'Delete')); return $link; }
public function map() { # Wrapper $map_content = new Brick('div'); $map_content->addClass('field-content field-google-map-ui'); $map_content->data($this->center); return $map_content; }
/** * Create input element. * * @since 1.0.0 * * @return Brick */ public function input() { $input = new Brick('input'); /* Set general attributes */ $input->attr(array('type' => 'text', 'name' => $this->name(), 'id' => $this->id(), 'value' => $this->value(), 'required' => $this->required(), 'autocomplete' => 'off', 'tabindex' => '-1', 'disabled' => $this->option('disabled'), 'readonly' => $this->option('readonly'))); $input->addClass('input-is-readonly'); /* Set data attributes */ $input->data(array('field' => 'rangesliderfield', 'min' => $this->option('min'), 'max' => $this->option('max'), 'step' => $this->option('step'), 'prefix' => $this->option('prefix'), 'postfix' => $this->option('postfix'))); return $input; }
/** * 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; }