/**
  * Implements PluginInterface::__construct().
  *
  * Create a new BasicCondition.
  *
  * @param $config array
  *  An array of configuration which includes the widget to use
  *  These should be specified as the 'widget' key.
  *  The widget key may be specified as class names or instantiated classes.
  * @param $manager \Drupal\sps\Manager
  *                 The current instance of the sps manager.
  *
  * @throws \Drupal\sps\Exception\NonoperativePluginException
  */
 public function __construct(array $config, \Drupal\sps\Manager $manager)
 {
     $this->overrides_info = $manager->getPluginByMeta('override', 'condition', $config['name']);
     if (empty($this->overrides_info)) {
         throw new \Drupal\sps\Exception\NonoperativePluginException("condition {$config['name']} does not have any overrides avaiable");
     }
     if (!empty($config['widget']) && is_string($config['widget'])) {
         $config['widget'] = $manager->getPlugin('widget', $config['widget']);
     }
     $this->title = isset($config['title']) ? $config['title'] : $config['name'];
     $this->widget = $config['widget'];
     $this->manager = $manager;
 }
Пример #2
0
 public function __construct(\Drupal\sps\StorageControllerInterface $config_controller = NULL)
 {
     $config_controller = $config_controller ?: new \Drupal\sps\Test\ConfigController();
     parent::__construct($config_controller);
 }