You are here

public function FormManglerService::addRabbitHoleOptionsToEntityForm in Rabbit Hole 2.x

Same name and namespace in other branches
  1. 8 src/FormManglerService.php \Drupal\rabbit_hole\FormManglerService::addRabbitHoleOptionsToEntityForm()

Form structure for the Rabbit Hole configuration.

This should be used by other modules that wish to implement the Rabbit Hole configurations in any form.

Parameters

array $attach: The form that the Rabbit Hole form should be attached to.

\Drupal\Core\Entity\EntityInterface $entity: The entity that we're adding the form to, e.g. a node. This should be defined even in the case of bundles since it is used to determine bundle and entity type.

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

string $form_id: Form ID.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/FormManglerService.php, line 135

Class

FormManglerService
Provides necessary form alterations.

Namespace

Drupal\rabbit_hole

Code

public function addRabbitHoleOptionsToEntityForm(array &$attach, EntityInterface $entity, FormStateInterface $form_state, $form_id) {
  $this
    ->addRabbitHoleOptionsToForm($attach, $entity
    ->getEntityType()
    ->id(), $entity, $form_state, $form_id);
}