You are here

public static function PaymentStatusForm::create in Payment 8.2

Same name in this branch
  1. 8.2 src/Entity/PaymentStatus/PaymentStatusForm.php \Drupal\payment\Entity\PaymentStatus\PaymentStatusForm::create()
  2. 8.2 src/Entity/Payment/PaymentStatusForm.php \Drupal\payment\Entity\Payment\PaymentStatusForm::create()

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides FormBase::create

1 call to PaymentStatusForm::create()
PaymentStatusFormTest::testCreate in tests/src/Unit/Entity/PaymentStatus/PaymentStatusFormTest.php
@covers ::create @covers ::__construct

File

src/Entity/PaymentStatus/PaymentStatusForm.php, line 62

Class

PaymentStatusForm
Provides the payment status add/edit form.

Namespace

Drupal\payment\Entity\PaymentStatus

Code

public static function create(ContainerInterface $container) {

  /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
  $entity_type_manager = $container
    ->get('entity_type.manager');

  /** @var \Drupal\plugin\PluginType\PluginTypeManagerInterface $plugin_type_manager */
  $plugin_type_manager = $container
    ->get('plugin.plugin_type_manager');
  return new static($container
    ->get('string_translation'), $entity_type_manager
    ->getStorage('payment_status'), $container
    ->get('plugin.manager.plugin.plugin_selector'), $plugin_type_manager
    ->getPluginType('payment_status'));
}