/** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $settings = $this->getSettings(); $element['open'] = array('#type' => 'checkbox', '#title' => t('Open'), '#default_value' => $settings['open']); $element += parent::settingsForm($form, $form_state); return $element; }
/** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $settings = $this->getSettings(); $element['number_column'] = array('#type' => 'checkbox', '#title' => t('Enable row number column'), '#default_value' => $settings['number_column'], '#attributes' => array('id' => 'number_column')); $element['number_column_label'] = array('#type' => 'textfield', '#title' => t('Number column label'), '#size' => 30, '#default_value' => $settings['number_column_label'], '#states' => array('visible' => array('#number_column' => array('checked' => TRUE)))); foreach (array('first', 'second') as $subfield) { $element[$subfield . '_column_label'] = array('#type' => 'textfield', '#title' => $subfield == 'first' ? t('First column label') : t('Second column label'), '#size' => 30, '#default_value' => $settings[$subfield . '_column_label']); } return $element + parent::settingsForm($form, $form_state); }
/** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $settings = $this->getSettings(); $element['inline'] = ['#type' => 'checkbox', '#title' => t('Display as inline element'), '#default_value' => $settings['inline']]; return $element + parent::settingsForm($form, $form_state); }