class ContainerForm
Same name and namespace in other branches
- 10 core/modules/forum/src/Form/ContainerForm.php \Drupal\forum\Form\ContainerForm
- 8.9.x core/modules/forum/src/Form/ContainerForm.php \Drupal\forum\Form\ContainerForm
Base form for container term edit forms.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
- class \Drupal\Core\Entity\ContentEntityForm implements \Drupal\Core\Entity\ContentEntityFormInterface extends \Drupal\Core\Entity\EntityForm
- class \Drupal\taxonomy\TermForm extends \Drupal\Core\Entity\ContentEntityForm
- class \Drupal\forum\Form\ForumForm extends \Drupal\taxonomy\TermForm
- class \Drupal\forum\Form\ContainerForm extends \Drupal\forum\Form\ForumForm
- class \Drupal\forum\Form\ForumForm extends \Drupal\taxonomy\TermForm
- class \Drupal\taxonomy\TermForm extends \Drupal\Core\Entity\ContentEntityForm
- class \Drupal\Core\Entity\ContentEntityForm implements \Drupal\Core\Entity\ContentEntityFormInterface extends \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
Expanded class hierarchy of ContainerForm
File
-
core/
modules/ forum/ src/ Form/ ContainerForm.php, line 12
Namespace
Drupal\forum\FormView source
class ContainerForm extends ForumForm {
/**
* Reusable URL stub to use in watchdog messages.
*
* @var string
*/
protected $urlStub = 'container';
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
// Build the bulk of the form from the parent forum form.
$form = parent::form($form, $form_state);
// Set the title and description of the name field.
$form['name']['#title'] = $this->t('Container name');
$form['name']['#description'] = $this->t('Short but meaningful name for this collection of related forums.');
// Alternate description for the container parent.
$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;
}
/**
* {@inheritdoc}
*/
public function buildEntity(array $form, FormStateInterface $form_state) {
$entity = parent::buildEntity($form, $form_state);
$entity->forum_container = TRUE;
return $entity;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.