textarea() public method

### Options: - escape - Whether or not the contents of the textarea should be escaped. Defaults to true.
public textarea ( string $fieldName, array $options = [] ) : string
$fieldName string Name of a field, in the form "modelname.fieldname"
$options array Array of HTML attributes, and special options above.
return string A generated HTML text input element
 public function textarea($fieldName, array $options = array())
 {
     $options += ['rows' => 3];
     $options = $this->_injectStyles($options, 'form-control');
     return parent::textarea($fieldName, $options);
 }
Beispiel #2
0
 /**
  * Creates a textarea widget
  * @param string $fieldName Field name, should be "Modelname.fieldname"
  * @param array $options HTML attributes and options
  * @return string
  */
 public function textarea($fieldName, array $options = [])
 {
     $options = $this->optionsDefaults(['cols' => null, 'rows' => null], $options);
     return parent::textarea($fieldName, $options);
 }
 public function textarea($fieldName, array $options = array())
 {
     $default_options = ['autosize' => true];
     $options = array_merge($default_options, $options);
     $script_block = null;
     if ($options['autosize']) {
         $this->AlaxosHtml->includeTextareaAutosizeJS();
         if (isset($options['id'])) {
             $dom_id = $options['id'];
         } else {
             $dom_id = $this->_domId($fieldName);
         }
         $script = [];
         $script[] = $this->AlaxosHtml->config('jquery_variable') . '(document).ready(function(){';
         $script[] = '  if(typeof(' . $this->AlaxosHtml->config('jquery_variable') . '("#' . $dom_id . '").autosize) != "undefined"){';
         $script[] = '    ' . $this->AlaxosHtml->config('jquery_variable') . '("#' . $dom_id . '").autosize();';
         $script[] = '  }';
         $script[] = '});';
         $script_block = $this->AlaxosHtml->scriptBlock(implode("\n", $script));
     }
     unset($options['autosize']);
     return parent::textarea($fieldName, $options) . $script_block;
 }