public ForumForm::form(array $form, FormStateInterface $form_state)
Gets the actual form array to be built.
Overrides TermForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- core/modules/forum/src/Form/ForumForm.php, line 31
 
Class
- ForumForm
 - Base form for forum term edit forms.
 
Namespace
Drupal\forum\Form
Code
public function form(array $form, FormStateInterface $form_state) {
  $taxonomy_term = $this->entity;
  // Build the bulk of the form from the parent taxonomy term form.
  $form = parent::form($form, $form_state, $taxonomy_term);
  // Set the title and description of the name field.
  $form['name']['#title'] = $this->t('Forum name');
  $form['name']['#description'] = $this->t('Short but meaningful name for this collection of threaded discussions.');
  // Change the description.
  $form['description']['#description'] = $this->t('Description and guidelines for discussions within this forum.');
  // Re-use the weight field.
  $form['weight'] = $form['relations']['weight'];
  // Remove the remaining relations fields.
  unset($form['relations']);
  // Our parent field is different to the taxonomy term.
  $form['parent']['#tree'] = TRUE;
  $form['parent'][0] = $this->forumParentSelect($taxonomy_term->id(), $this->t('Parent'));
  $form['#theme_wrappers'] = array('form__forum');
  $this->forumFormType = $this->t('forum');
  return $form;
}
Please login to continue.