'textarea', * '#title' => $this->t('Text'), * ); * @endcode * * @see \Drupal\Core\Render\Element\Textfield * @see \Drupal\filter\Element\TextFormat * * @FormElement("textarea") */ class Textarea extends FormElement { /** * {@inheritdoc} */ public function getInfo() { $class = get_class($this); return [ '#input' => TRUE, '#cols' => 60, '#rows' => 5, '#resizable' => 'vertical', '#process' => [ [$class, 'processAjaxForm'], [$class, 'processGroup'], ], '#pre_render' => [ [$class, 'preRenderGroup'], ], '#theme' => 'textarea', '#theme_wrappers' => ['form_element'], ]; } /** * {@inheritdoc} */ public static function valueCallback(&$element, $input, FormStateInterface $form_state) { if ($input !== FALSE && $input !== NULL) { // This should be a string, but allow other scalars since they might be // valid input in programmatic form submissions. return is_scalar($input) ? (string) $input : ''; } return NULL; } }