protected function init()
    {
        parent::init();
        $EMPTY = self::EMPTY_IMAGE;
        $js = <<<JS
selenia.ext.imageField = {
  clear: function (id) {
    var e = \$('#'+id);
    e.find('img').prop('src','{$EMPTY}').css('background-image','');
    e.find('input[type=hidden]').val('');
    e.find('span').text('');
    e.find('.clearBtn').hide();
  },
  onChange: function (id) {
    selenia.ext.imageField.clear(id);
    var e = \$('#'+id);
    var input = e.find('input[type=file]');
    var name = input.val().replace(/^.*(\\/|\\\\)/, '');
    e.find('span').text(name);
    e.find('.clearBtn').show();
    if ('FileReader' in window) {
      var reader = new FileReader();
      reader.onload = function (ev) {
        e.find('img').css('background-image', 'url('+ev.target.result+')');
      };
      reader.readAsDataURL(input[0].files[0]);
    }
  }
};
JS;
        $this->context->getAssetsService()->addInlineScript($js, 'ImageFieldInit');
    }
 protected function preRender()
 {
     $id = property($this->props, 'id');
     if ($id) {
         $this->props->containerId = $this->props->id . 'Container';
     }
     parent::preRender();
 }
 protected function preRender()
 {
     if (exists($this->props->icon)) {
         $this->addClass('with-icon');
     }
     if (!str_contains($this->props->class, 'btn-')) {
         $this->addClass('btn-default');
     }
     parent::preRender();
 }
 protected function preRender()
 {
     $prop = $this->props;
     // Output a hidden checkbox that will submit an empty value if the visible checkbox is not checked.
     // Does not apply to checkboxes of array fields.
     if (exists($prop->name) && !str_endsWith($prop->name, '[]')) {
         echo "<input type=checkbox name=\"{$prop->name}\" value=\"\" checked style=\"display:none\">";
     }
     $id = property($prop, 'id');
     if ($id) {
         $prop->containerId = $prop->id . 'Container';
     }
     echo "<!--CHECKBOX-->";
     parent::preRender();
 }
 protected function init()
 {
     parent::init();
     //    $this->context->getAssetsService ()->addStylesheet ('modules/electro-modules/matisse-components/css/metisMenu.css');
     //    $this->context->getAssetsService ()->addScript ('modules/electro-modules/matisse-components/js/metisMenu.js');
 }
 protected function init()
 {
     parent::init();
     $this->context->getAssetsService()->addStylesheet('lib/datatables.net-bs/css/dataTables.bootstrap.min.css', true)->addStylesheet('lib/datatables.net-responsive-bs/css/responsive.bootstrap.min.css')->addStylesheet('lib/datatables.net-buttons-bs/css/buttons.bootstrap.min.css')->addScript('lib/datatables.net/js/jquery.dataTables.min.js')->addScript('lib/datatables.net-bs/js/dataTables.bootstrap.min.js')->addScript('lib/datatables.net-responsive/js/dataTables.responsive.min.js')->addScript('lib/datatables.net-buttons/js/dataTables.buttons.min.js')->addScript('lib/datatables.net-buttons-bs/js/buttons.bootstrap.min.js');
 }
 protected function postRender()
 {
     parent::postRender();
     echo html([h('input', ['type' => 'hidden', 'name' => $this->props->id])]);
 }
 protected function preRender()
 {
     $prop = $this->props;
     if (!isset($prop->width) || !isset($prop->height)) {
         $this->containerTag = 'img';
     }
     if (isset($prop->value)) {
         parent::preRender();
     }
 }
 protected function preRender()
 {
     $this->props->containerId = $this->props->id . 'Container';
     parent::preRender();
 }
 protected function preRender()
 {
     $props = $this->props;
     $assets = $this->context->getAssetsService();
     // Non-native selects are implemented with the Chosen javascript widget.
     if (!$props->native) {
         $this->addClass('chosen-select');
     }
     parent::preRender();
 }
 protected function preRender()
 {
     $this->cssClassName = $this->props->fieldClass;
     parent::preRender();
 }
 protected function preRender()
 {
     $prop = $this->props;
     $type = $prop->get('type', 'text');
     switch ($type) {
         case 'multiline':
             $this->containerTag = 'textarea';
             break;
         case 'color':
             $this->containerTag = 'div';
             $this->addClass('input-group');
             break;
         default:
             $this->containerTag = 'input';
             $this->addClass("type-{$type}");
     }
     if ($prop->readOnly) {
         $this->addClass('readonly');
     }
     parent::preRender();
 }
示例#13
0
 protected function preRender()
 {
     $prop = $this->props;
     if ($link = $prop->link) {
         extend($prop, ['label' => $link->title(), 'href' => $link->url(), 'icon' => $link->icon(), 'active' => $link->isActive()]);
     }
     $this->disabled = is_null($prop->href) && !exists($prop->script) || $prop->disabled;
     if ($this->disabled) {
         $this->addClass($prop->disabledClass);
     }
     if ($prop->active || exists($prop->href) && str_beginsWith($prop->currentUrl, $prop->href) || $prop->href === '' && $prop->currentUrl === '') {
         $this->cssClassName = $prop->activeClass;
     }
     if (!empty($prop->wrapper)) {
         $this->containerTag = $prop->wrapper;
     }
     parent::preRender();
 }
 protected function preRender()
 {
     if ($this->props->total > 1) {
         parent::preRender();
     }
 }