3 namespace Drupal\forum\Form;
5 use Drupal\Core\Form\FormStateInterface;
8 * Base form for container term edit forms.
10 class ContainerForm extends ForumForm {
13 * Reusable url stub to use in watchdog messages.
17 protected $urlStub = 'container';
22 public function form(array $form, FormStateInterface $form_state) {
23 $taxonomy_term = $this->entity;
24 // Build the bulk of the form from the parent forum form.
25 $form = parent::form($form, $form_state, $taxonomy_term);
27 // Set the title and description of the name field.
28 $form['name']['#title'] = $this->t('Container name');
29 $form['name']['#description'] = $this->t('Short but meaningful name for this collection of related forums.');
31 // Alternate description for the container parent.
32 $form['parent'][0]['#description'] = $this->t('Containers are usually placed at the top (root) level, but may also be placed inside another container or forum.');
33 $this->forumFormType = $this->t('forum container');
40 public function buildEntity(array $form, FormStateInterface $form_state) {
41 $entity = parent::buildEntity($form, $form_state);
42 $entity->forum_container = TRUE;