3a7938c192f529975b9c7af2d3595959b629c3ea
[yaffs-website] / BootstrapLayouts / BootstrapLayoutsUpdateBase.php
1 <?php
2
3 namespace Drupal\bootstrap_layouts\Plugin\BootstrapLayouts;
4
5 use Drupal\bootstrap_layouts\BootstrapLayout;
6 use Drupal\bootstrap_layouts\BootstrapLayoutsManager;
7 use Drupal\Core\Plugin\PluginBase;
8 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
9 use Symfony\Component\DependencyInjection\ContainerInterface;
10
11 class BootstrapLayoutsUpdateBase extends PluginBase implements BootstrapLayoutsUpdateInterface {
12
13   use ContainerAwareTrait;
14
15   /**
16    * The path to the provider.
17    *
18    * @var string
19    */
20   protected $path;
21
22   /**
23    * {@inheritdoc}
24    */
25   public function __construct(array $configuration, $plugin_id, $plugin_definition, ContainerInterface $container = NULL) {
26     parent::__construct($configuration, $plugin_id, $plugin_definition);
27     if (!isset($container)) {
28       $container = \Drupal::getContainer();
29     }
30     $this->setContainer($container);
31
32     // Retrieve the path to provider.
33     $this->path = drupal_get_path('module', $this->pluginDefinition['provider']) ?: drupal_get_path('theme', $this->pluginDefinition['provider']);
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
40     return new static($configuration, $plugin_id, $plugin_definition, $container);
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function getPath() {
47     return $this->path;
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function update(BootstrapLayoutsManager $manager, array $data = [], $display_messages = TRUE) {
54   }
55
56   /**
57    * {@inheritdoc}
58    */
59   public function processExistingLayout(BootstrapLayout $layout, array $data = [], $display_messages = TRUE) {
60   }
61
62 }