ContainerForm.php in Drupal 8
File
core/modules/forum/src/Form/ContainerForm.php
View source
<?php
namespace Drupal\forum\Form;
use Drupal\Core\Form\FormStateInterface;
class ContainerForm extends ForumForm {
protected $urlStub = 'container';
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['name']['#title'] = $this
->t('Container name');
$form['name']['#description'] = $this
->t('Short but meaningful name for this collection of related forums.');
$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.');
$this->forumFormType = $this
->t('forum container');
return $form;
}
public function buildEntity(array $form, FormStateInterface $form_state) {
$entity = parent::buildEntity($form, $form_state);
$entity->forum_container = TRUE;
return $entity;
}
}