Example #1
0
    /**
     * Method to test prepareAttributes().
     *
     * @return void
     *
     * @covers Windwalker\Form\Field\TextField::prepareAttributes
     */
    public function testRender()
    {
        $html = <<<HTML
<input type="text" name="flower" id="test-field" class="stub-flower" placeholder="th" size="60" maxlength="10" readonly="true" disabled="true" onchange="javascript:void(0);" />
HTML;
        $this->assertDomStringEqualsDomString($html, $this->instance->renderInput());
    }
Example #2
0
 /**
  * buildInput
  *
  * @param array $attrs
  *
  * @return  string
  */
 public function buildInput($attrs)
 {
     // Convert timezone
     $from = $this->get('from', 'UTC');
     $to = $this->get('to', Ioc::getConfig()->get('system.timezone', 'UTC'));
     if ($attrs['value'] && $attrs['value'] != static::EMPTY_DATETIME) {
         $attrs['value'] = DateTime::convert($attrs['value'], $from, $to);
     }
     $input = parent::buildInput($attrs);
     $format = $this->get('format', 'YYYY-MM-DD HH:mm:ss');
     $id = $this->getId();
     return WidgetHelper::render('phoenix.form.field.calendar', array('id' => $id, 'input' => $input, 'attrs' => $attrs, 'format' => $format, 'field' => $this), WidgetHelper::EDGE);
 }
Example #3
0
 /**
  * buildInput
  *
  * @param array $attrs
  *
  * @return  string
  */
 public function buildInput($attrs)
 {
     $this->prepareScript();
     $this->package = $this->package ?: $this->get('package');
     $this->view = $this->view ?: $this->get('view');
     $attribs = $attrs;
     /** @var HtmlElement $input */
     $input = parent::buildInput($attribs);
     $input['type'] = 'hidden';
     $input['data-value-store'] = true;
     $url = $this->get('url') ?: $this->getUrl();
     $id = $this->getId();
     return WidgetHelper::render('phoenix.form.field.modal', array('id' => $id, 'title' => $this->getTitle(), 'input' => $input, 'url' => $url, 'attrs' => $attrs, 'field' => $this), WidgetHelper::EDGE);
 }
Example #4
0
 /**
  * prepareRenderInput
  *
  * @param array $attrs
  *
  * @return  array
  */
 public function prepare(&$attrs)
 {
     parent::prepare($attrs);
     $attrs['width'] = $this->get('width', 300);
     $attrs['height'] = $this->get('height', 300);
 }