You are here

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

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

Add rabbit hole options to an entity type's global configuration form.

(E.g. options for all users).

Parameters

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

string $entity_type: The name of the entity for which this form provides global options.

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

string $form_id: Form ID.

File

src/FormManglerService.php, line 107

Class

FormManglerService
Provides necessary form alterations.

Namespace

Drupal\rabbit_hole

Code

public function addRabbitHoleOptionsToGlobalForm(array &$attach, $entity_type, FormStateInterface $form_state, $form_id) {
  $entity_type = $this->entityTypeManager
    ->getStorage($entity_type)
    ->getEntityType();
  $this
    ->addRabbitHoleOptionsToForm($attach, $entity_type
    ->id(), NULL, $form_state, $form_id);
}