TRUE]; $options['hide_alter_empty'] = ['default' => FALSE]; return $options; } /** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); // Remove the checkbox unset($form['alter']['alter_text']); unset($form['alter']['text']['#states']); unset($form['alter']['help']['#states']); $form['#pre_render'][] = [$this, 'preRenderCustomForm']; } /** * {@inheritdoc} */ public function render(ResultRow $values) { // Return the text, so the code never thinks the value is empty. return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options['alter']['text'])); } /** * Prerender function to move the textarea to the top of a form. * * @param array $form * The form build array. * * @return array * The modified form build array. */ public function preRenderCustomForm($form) { $form['text'] = $form['alter']['text']; $form['help'] = $form['alter']['help']; unset($form['alter']['text']); unset($form['alter']['help']); return $form; } }