3 namespace Drupal\forum\Form;
5 use Drupal\Core\Form\FormStateInterface;
8 * Base form for container term edit forms.
12 class ContainerForm extends ForumForm {
15 * Reusable url stub to use in watchdog messages.
19 protected $urlStub = 'container';
24 public function form(array $form, FormStateInterface $form_state) {
25 // Build the bulk of the form from the parent forum form.
26 $form = parent::form($form, $form_state);
28 // Set the title and description of the name field.
29 $form['name']['#title'] = $this->t('Container name');
30 $form['name']['#description'] = $this->t('Short but meaningful name for this collection of related forums.');
32 // Alternate description for the container parent.
33 $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.');
34 $this->forumFormType = $this->t('forum container');
41 public function buildEntity(array $form, FormStateInterface $form_state) {
42 $entity = parent::buildEntity($form, $form_state);
43 $entity->forum_container = TRUE;