You are here

class ConfigOperationsProvider in Payment 8.2

Provides payment status operations payment statuses based on config entities.

Hierarchy

Expanded class hierarchy of ConfigOperationsProvider

1 file declares its use of ConfigOperationsProvider
ConfigOperationsProviderTest.php in tests/src/Unit/Plugin/Payment/Status/ConfigOperationsProviderTest.php
1 string reference to 'ConfigOperationsProvider'
payment.payment.status.yml in ./payment.payment.status.yml
payment.payment.status.yml

File

src/Plugin/Payment/Status/ConfigOperationsProvider.php, line 17

Namespace

Drupal\payment\Plugin\Payment\Status
View source
class ConfigOperationsProvider implements PluginOperationsProviderInterface, ContainerInjectionInterface {

  /**
   * The payment status list builder.
   *
   * @var \Drupal\Core\Entity\EntityListBuilderInterface
   */
  protected $paymentStatusListBuilder;

  /**
   * The payment status storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $paymentStatusStorage;

  /**
   * Constructs a new instance.
   *
   * @param \Drupal\Core\Entity\EntityStorageInterface $payment_status_storage
   *   The payment status storage.
   * @param \Drupal\Core\Entity\EntityListBuilderInterface $payment_status_list_builder
   *   The payment status list builder.
   */
  public function __construct(EntityStorageInterface $payment_status_storage, EntityListBuilderInterface $payment_status_list_builder) {
    $this->paymentStatusListBuilder = $payment_status_list_builder;
    $this->paymentStatusStorage = $payment_status_storage;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {

    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $container
      ->get('entity_type.manager');
    return new static($entity_type_manager
      ->getStorage('payment_status'), $entity_type_manager
      ->getListBuilder('payment_status'));
  }

  /**
   * {@inheritdoc}
   */
  public function getOperations($plugin_id) {
    $entity_id = substr($plugin_id, 15);
    $entity = $this->paymentStatusStorage
      ->load($entity_id);
    return $this->paymentStatusListBuilder
      ->getOperations($entity);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigOperationsProvider::$paymentStatusListBuilder protected property The payment status list builder.
ConfigOperationsProvider::$paymentStatusStorage protected property The payment status storage.
ConfigOperationsProvider::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
ConfigOperationsProvider::getOperations public function Gets plugin operations. Overrides PluginOperationsProviderInterface::getOperations
ConfigOperationsProvider::__construct public function Constructs a new instance.