summaryrefslogtreecommitdiffstatshomepage
path: root/core/lib/Drupal/Core/Plugin/ConfigurablePluginBase.php
blob: 0d51a8025562b33b3a5d8dfff547171647a89ed8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

declare(strict_types=1);

namespace Drupal\Core\Plugin;

use Drupal\Component\Plugin\ConfigurableInterface;

/**
 * Base class for plugins that are configurable.
 *
 * Provides boilerplate methods for implementing
 * Drupal\Component\Plugin\ConfigurableInterface. Configurable plugins may
 * extend this base class instead of PluginBase. If your plugin must extend a
 * different base class, you may use \Drupal\Component\Plugin\ConfigurableTrait
 * directly and call setConfiguration() in your constructor.
 *
 * @see \Drupal\Core\Plugin\ConfigurableTrait
 */
abstract class ConfigurablePluginBase extends PluginBase implements ConfigurableInterface {
  use ConfigurableTrait;

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->setConfiguration($configuration);
  }

}