public function FlagAddForm::buildForm in Flag 8.4
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FlagFormBase::buildForm
File
- src/
Form/ FlagAddForm.php, line 22
Class
- FlagAddForm
- Provides the flag add form.
Namespace
Drupal\flag\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $entity_type = NULL) {
$form = parent::buildForm($form, $form_state, $entity_type);
$form['global']['#description'] = $this
->t('The scope cannot be changed once a flag has been saved.');
// While editing, the default value reflects the current link type.
// Here set the initial value to be an AJAX action link.
$form['display']['link_type']['#default_value'] = 'ajax_link';
return $form;
}