コード例 #1
0
 /**
  * @inheritdoc
  */
 public function render($content = null)
 {
     if ($content === null) {
         if (!isset($this->parts['{beginWrapper}'])) {
             $options = $this->wrapperOptions;
             $tag = ArrayHelper::remove($options, 'tag', 'div');
             $this->parts['{beginWrapper}'] = Html::beginTag($tag, $options);
             $this->parts['{endWrapper}'] = Html::endTag($tag);
         }
         if ($this->enableLabel === false) {
             $this->parts['{label}'] = '';
             $this->parts['{beginLabel}'] = '';
             $this->parts['{labelTitle}'] = '';
             $this->parts['{endLabel}'] = '';
         } elseif (!isset($this->parts['{beginLabel}'])) {
             $this->renderLabelParts();
         }
         if ($this->enableError === false) {
             $this->parts['{error}'] = '';
         }
         if ($this->inputTemplate) {
             $input = isset($this->parts['{input}']) ? $this->parts['{input}'] : Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
             $this->parts['{input}'] = strtr($this->inputTemplate, ['{input}' => $input]);
         }
     }
     $this->buildTemplate();
     return parent::render($content);
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function render($content = null)
 {
     echo "here";
     if ($content === null) {
         if (!isset($this->parts['{beginWrapper}'])) {
             $options = $this->wrapperOptions;
             $tag = ArrayHelper::remove($options, 'tag', 'div');
             $this->parts['{beginWrapper}'] = Html::beginTag($tag, $options);
             $this->parts['{endWrapper}'] = Html::endTag($tag);
         }
         if ($this->enableLabel === false) {
             $this->parts['{label}'] = '';
             $this->parts['{beginLabel}'] = '';
             $this->parts['{labelTitle}'] = '';
             $this->parts['{endLabel}'] = '';
         } elseif (!isset($this->parts['{beginLabel}'])) {
             $this->renderLabelParts();
         }
         if ($this->enableError === false) {
             $this->parts['{error}'] = '';
         }
         if ($this->inputTemplate) {
             $input = isset($this->parts['{input}']) ? $this->parts['{input}'] : Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
             $newInput = $this->contentBeforeInput . $this->generateAddon() . $this->contentAfterInput;
             var_dump($newInput);
             exit;
             $this->parts['{input}'] = strtr($this->inputTemplate, ['{input}' => $newInput]);
             //  $this->template = strtr($this->template, [
             //     '{input}' => str_replace('{input}', $newInput, $input),
             // ]);
         }
     }
     // $this->buildTemplate();
     //  $newInput = $this->contentBeforeInput . $this->generateAddon(). $this->contentAfterInput;
     //  $this->template = strtr($this->template, [
     //     '{input}' => str_replace('{input}', $newInput, $input),
     // ]);
     var_dump($content);
     return parent::render($content);
 }