Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
AuthorizationProfileAddForm
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 create
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 getFormId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 form
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\authorization\Form;
6
7use Drupal\Core\Entity\EntityTypeManagerInterface;
8use Drupal\Core\Form\FormStateInterface;
9use Drupal\authorization\Consumer\ConsumerPluginManager;
10use Drupal\authorization\Provider\ProviderPluginManager;
11use Symfony\Component\DependencyInjection\ContainerInterface;
12
13/**
14 * Authorization profile form.
15 *
16 * @package Drupal\authorization\Form
17 */
18final class AuthorizationProfileAddForm extends AuthorizationProfileForm {
19
20  /**
21   * Constructs a AuthorizationProfileForm.
22   *
23   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
24   *   The entity manager.
25   * @param \Drupal\authorization\Provider\ProviderPluginManager $provider_plugin_manager
26   *   The Provider plugin manager.
27   * @param \Drupal\authorization\Consumer\ConsumerPluginManager $consumer_plugin_manager
28   *   The Consumer plugin manager.
29   */
30  public function __construct(
31    EntityTypeManagerInterface $entity_type_manager,
32    ProviderPluginManager $provider_plugin_manager,
33    ConsumerPluginManager $consumer_plugin_manager,
34  ) {
35    $this->storage = $entity_type_manager->getStorage('authorization_profile');
36    $this->providerPluginManager = $provider_plugin_manager;
37    $this->consumerPluginManager = $consumer_plugin_manager;
38  }
39
40  /**
41   * {@inheritdoc}
42   */
43  public static function create(ContainerInterface $container) {
44    return new static(
45      $container->get('entity_type.manager'),
46      $container->get('plugin.manager.authorization.provider'),
47      $container->get('plugin.manager.authorization.consumer')
48    );
49  }
50
51  /**
52   * {@inheritdoc}
53   */
54  public function getFormId(): string {
55    return 'authorization_profile_add_form';
56  }
57
58  /**
59   * {@inheritdoc}
60   */
61  public function form(array $form, FormStateInterface $form_state): array {
62    $form = parent::form($form, $form_state);
63    $this->buildEntityForm($form, $form_state, TRUE);
64
65    return $form;
66  }
67
68}