Пример #1
0
 public function input()
 {
     $input = parent::input();
     if (isset($this->data)) {
         $input->data('url', html(json_encode($this->data), false));
     } else {
         if ($page = $this->page()) {
             foreach ($page->files() as $file) {
                 if ($file->type() == 'image') {
                     $media[$file->name()]['orientation'] = (string) $file->orientation();
                     $media[$file->name()]['thumbnail'] = (string) $file->url();
                     $media[$file->name()]['width'] = (string) $file->width();
                     $media[$file->name()]['height'] = (string) $file->height();
                 }
                 if ($media[$file->name()]['type'] != 'video') {
                     $media[$file->name()]['type'] = (string) $file->type();
                 }
                 $media[$file->name()][$file->extension()] = (string) $file->url();
                 $media[$file->name()]['url'] = (string) $file->url();
                 $media[$file->name()]['name'] = (string) $file->name();
             }
             $mediajson = html(json_encode($media));
             $input->data(array('media' => $mediajson, 'field' => 'gallery'));
         }
     }
     //$input->tag('div');
     //$input->removeAttr('type');
     //$input->removeAttr('value');
     return $input;
 }
Пример #2
0
 public function input()
 {
     $input = parent::input();
     $input->addClass('icon_text');
     $input->data('field', 'iconfield');
     return $input;
 }
Пример #3
0
 public function input()
 {
     $input = parent::input();
     if ($this->suggestion) {
         $input->data(array('field' => 'passwordSuggestion'));
     }
     return $input;
 }
Пример #4
0
 public function input()
 {
     $input = parent::input();
     if (!$this->readonly() && ($this->minLength() || $this->maxLength())) {
         $input->data('max', $this->maxLength())->data('min', $this->minLength());
     }
     return $input;
 }
Пример #5
0
 public function input()
 {
     $input = parent::input();
     $input->attr('step', $this->step);
     $input->attr('min', $this->min);
     $input->attr('max', $this->max);
     return $input;
 }
Пример #6
0
 public function input()
 {
     $input = parent::input();
     if ($this->autocomplete) {
         $input->attr('autocomplete', 'off');
         $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/emails'));
     }
     return $input;
 }
Пример #7
0
 public function input()
 {
     $input = parent::input();
     $input->tag('textarea');
     $input->removeAttr('type');
     $input->removeAttr('value');
     $input->html($this->value() ?: false);
     $input->data('field', 'editor');
     return $input;
 }
Пример #8
0
 public function input()
 {
     $input = parent::input();
     $input->tag('textarea');
     $input->removeAttr('type');
     $input->removeAttr('value');
     $input->html($this->value() ? htmlentities($this->value(), ENT_NOQUOTES, 'UTF-8') : false);
     $input->data('field', 'editor');
     return $input;
 }
Пример #9
0
 public function input()
 {
     $input = parent::input();
     $input->data("field", "pikatime");
     if (isset($this->mode)) {
         $input->data("mode", $this->mode());
     } else {
         $input->data("mode", "24");
     }
     return $input;
 }
Пример #10
0
 public function input()
 {
     $input = parent::input();
     $input->removeAttr('name');
     $input->data(array('field' => 'date', 'format' => $this->format(), 'i18n' => html(json_encode(array('previousMonth' => '‹', 'nextMonth' => '›', 'months' => l::get('fields.date.months'), 'weekdays' => l::get('fields.date.weekdays'), 'weekdaysShort' => l::get('fields.date.weekdays.short'))), false)));
     $hidden = new Brick('input', null);
     $hidden->type = 'hidden';
     $hidden->name = $this->name();
     $hidden->value = $this->value();
     return $input . $hidden;
 }
Пример #11
0
 public function input()
 {
     $input = new Brick('input', null);
     $input->addClass('tabfield');
     $input->attr(array('id' => $this->id(), 'name' => $this->name(), 'required' => $this->required(), 'autofocus' => $this->autofocus(), 'autocomplete' => $this->autocomplete(), 'readonly' => $this->readonly(), 'type' => 'checkbox', 'checked' => v::accepted($this->value())));
     $wrapper = parent::input();
     $wrapper->tag('label');
     $wrapper->text($this->i18n($this->text()));
     $wrapper->attr('for', $this->id());
     $wrapper->removeAttr('id');
     $wrapper->addClass('tabfield');
     $wrapper->prepend($input);
     return $wrapper;
 }
 public function input()
 {
     $input = parent::input();
     function loopThroughLevels($collection, &$everything)
     {
         foreach ($collection as $item) {
             //echo($item->title());
             $files = $item->images()->toArray();
             foreach ($files as $file) {
                 $file['permalink'] = $item->uri();
                 $everything[] = $file;
             }
             if ($item->hasChildren()) {
                 loopThroughLevels($item->children(), $everything);
             }
         }
         return $everything;
     }
     $everything = loopThroughLevels(kirby()->site()->children(), $everything = []);
     $mediajson = html(json_encode($everything));
     $input->data(array('media' => $mediajson, 'field' => 'composition'));
     //This needs to be here...
     return $input;
 }
Пример #13
0
 public function input()
 {
     $input = parent::input();
     $input->data('field', 'urlfield');
     return $input;
 }
Пример #14
0
 public function input()
 {
     $input = parent::input();
     $input->data(array('field' => 'date', 'format' => $this->format(), 'i18n' => html(json_encode(array('previousMonth' => '‹', 'nextMonth' => '›', 'months' => l::get('fields.date.months'), 'weekdays' => l::get('fields.date.weekdays'), 'weekdaysShort' => l::get('fields.date.weekdays.short'))), false)));
     return $input;
 }
 /**
  * Create input element.
  *
  * @since 1.0.0
  *
  * @return \Brick
  */
 public function input()
 {
     // Set up textarea
     $input = parent::input();
     $input->tag('textarea');
     $input->removeAttr('type');
     $input->removeAttr('value');
     $input->html($this->value() ?: false);
     $input->data(array('field' => 'codeeditorfield', 'editor' => '#' . $this->id() . '-editor', 'mode' => $this->mode, 'theme' => $this->theme, 'height' => $this->height, 'folding' => $this->folding, 'require-path' => purl($this->page(), 'field/' . $this->name() . '/codeeditor/ace/require')));
     /**
      * FIX: Prevent Google Chrome from trying to validate the underlying
      * invisible textarea. The Panel will handle this instead.
      *
      * See: https://github.com/JonasDoebertin/kirby-visual-markdown/issues/42
      */
     $input->removeAttr('required');
     // Set up wrapping element
     $wrapper = new Brick('div', false);
     $wrapper->addClass('codeeditor-wrapper');
     $wrapper->addClass('codeeditor-field-' . $this->name);
     if ($this->height === 'auto') {
         $wrapper->addClass('codeeditor-field-autoheight');
     }
     // Set up code editor element
     $editor = new Brick('div', false);
     $editor->addClass('codeeditor-editor');
     $editor->attr('id', $this->id() . '-editor');
     $editor->append($this->value());
     return $wrapper->append($input)->append($editor);
 }
Пример #16
0
 /**
  * Create input element.
  *
  * @since 1.0.0
  * @return \Brick
  */
 public function input()
 {
     // Set up modals
     $modals = tpl::load(__DIR__ . DS . 'partials' . DS . 'modals.php', ['field' => $this]);
     // Set up translation
     $translation = tpl::load(__DIR__ . DS . 'partials' . DS . 'translation.php', ['translations' => $this->translation]);
     // Set up textarea
     $input = parent::input();
     $input->tag('textarea');
     $input->removeAttr('type');
     $input->removeAttr('value');
     $input->html($this->value() ?: false);
     $input->data(['field' => 'markdownfield', 'toolbar' => $this->toolbar ? 'true' : 'false', 'tools' => implode(',', $this->tools), 'header1' => $this->header1, 'header2' => $this->header2, 'kirbytext' => c::get('panel.kirbytext', true) ? 'true' : 'false']);
     /*
        FIX: Prevent Google Chrome from trying to validate the underlying
        invisible textarea. the Panel will handle this instead.
     
        See: https://github.com/JonasDoebertin/kirby-visual-markdown/issues/42
     */
     $input->removeAttr('required');
     // Set up wrapping element
     $wrapper = new Brick('div', false);
     $wrapper->addClass('markdownfield-wrapper');
     $wrapper->addClass('markdownfield-field-' . $this->name);
     return $wrapper->append($modals)->append($translation)->append($input);
 }
Пример #17
0
 /**
  * Create input element
  *
  * @since 1.0.0
  *
  * @return \Brick
  */
 public function input()
 {
     // Set up modals
     $modals = tpl::load(__DIR__ . DS . 'partials' . DS . 'modals.php', array('field' => $this));
     // Set up translation
     $translation = tpl::load(__DIR__ . DS . 'partials' . DS . 'translation.php', array('translations' => $this->translation));
     // Set up textarea
     $input = parent::input();
     $input->tag('textarea');
     $input->removeAttr('type');
     $input->removeAttr('value');
     $input->html($this->value() ?: false);
     $input->data(array('field' => 'markdownfield', 'toolbar' => $this->toolbar ? 'true' : 'false', 'tools' => implode(',', $this->tools), 'header1' => $this->header1, 'header2' => $this->header2, 'kirbytext' => c::get('panel.kirbytext', true) ? 'true' : 'false'));
     // Set up wrapping element
     $wrapper = new Brick('div', false);
     $wrapper->addClass('markdownfield-wrapper');
     $wrapper->addClass('markdownfield-field-' . $this->name);
     return $wrapper->append($modals)->append($translation)->append($input);
 }
Пример #18
0
 public function input()
 {
     $input = parent::input();
     $input->removeClass('input');
     return $input;
 }
Пример #19
0
 public function input()
 {
     $input = parent::input();
     $input->data(array('field' => 'autocomplete', 'url' => url('panel/api/autocomplete/usernames')));
     return $input;
 }
Пример #20
0
 public function input()
 {
     $input = parent::input();
     $input->data(array('field' => 'autocomplete', 'url' => panel()->urls()->api() . '/autocomplete/uris'));
     return $input;
 }