You are here

final class DeveloperAppFieldConfigListAlterEventSubscriber in Apigee Edge 8

Adds base field configuration form to developer app entity's field config UI.

Hierarchy

Expanded class hierarchy of DeveloperAppFieldConfigListAlterEventSubscriber

1 string reference to 'DeveloperAppFieldConfigListAlterEventSubscriber'
apigee_edge.services.yml in ./apigee_edge.services.yml
apigee_edge.services.yml
1 service uses DeveloperAppFieldConfigListAlterEventSubscriber
apigee_edge.event_subscriber.developer_app_field_config_list_alter_event_subscriber in ./apigee_edge.services.yml
Drupal\apigee_edge\EventSubscriber\DeveloperAppFieldConfigListAlterEventSubscriber

File

src/EventSubscriber/DeveloperAppFieldConfigListAlterEventSubscriber.php, line 31

Namespace

Drupal\apigee_edge\EventSubscriber
View source
final class DeveloperAppFieldConfigListAlterEventSubscriber implements EventSubscriberInterface {

  /**
   * The form builder service.
   *
   * @var \Drupal\Core\Form\FormBuilderInterface
   */
  private $formBuilder;

  /**
   * DeveloperAppFieldConfigListAlterEventSubscriber constructor.
   *
   * @param \Drupal\Core\Form\FormBuilderInterface $form_builder
   *   The form builder service.
   */
  public function __construct(FormBuilderInterface $form_builder) {
    $this->formBuilder = $form_builder;
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      EdgeEntityFieldConfigListAlterEvent::EVENT_NAME => 'alterPage',
    ];
  }

  /**
   * Alters the field config UI page.
   *
   * @param \Drupal\apigee_edge\Event\EdgeEntityFieldConfigListAlterEvent $event
   *   The field config list alter event.
   */
  public function alterPage(EdgeEntityFieldConfigListAlterEvent $event) {
    if ($event
      ->getEntityType() === 'developer_app') {
      $page =& $event
        ->getPage();
      $page['base_field_config'] = $this->formBuilder
        ->getForm(DeveloperAppBaseFieldConfigForm::class);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeveloperAppFieldConfigListAlterEventSubscriber::$formBuilder private property The form builder service.
DeveloperAppFieldConfigListAlterEventSubscriber::alterPage public function Alters the field config UI page.
DeveloperAppFieldConfigListAlterEventSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
DeveloperAppFieldConfigListAlterEventSubscriber::__construct public function DeveloperAppFieldConfigListAlterEventSubscriber constructor.