/**
  * {@inheritdoc}
  */
 public function validateConfigurationForm(array $form, FormStateInterface $form_state, FacetInterface $facet)
 {
     $values = $form_state->getValues();
     if (!empty($values['maximum_items']) && !empty($values['minimum_items']) && $values['maximum_items'] <= $values['minimum_items']) {
         $form_state->setErrorByName('maximum_items', t('If both minimum and maximum item count are specified, the maximum item count should be higher than the minimum item count.'));
     }
     return parent::validateConfigurationForm($form, $form_state, $facet);
 }
 /**
  * Constructs a new instance of the class.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param mixed $plugin_definition
  *   The plugin implementation definition.
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   A request object for the current request.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, Request $request)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->request = $request;
     if (!isset($configuration['facet'])) {
         throw new InvalidProcessorException("The url processor doesn't have the required 'facet' in the configuration array.");
     }
     /** @var \Drupal\facets\FacetInterface $facet */
     $facet = $configuration['facet'];
     /** @var \Drupal\facets\FacetSourceInterface $facet_source_config */
     $facet_source_config = $facet->getFacetSourceConfig();
     $this->filterKey = $facet_source_config->getFilterKey() ?: 'f';
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(array $configuration, $plugin_id, array $plugin_definition)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     if (!isset($configuration['facet']) || !$configuration['facet'] instanceof FacetInterface) {
         throw new InvalidProcessorException("The UrlProcessorHandler doesn't have the required 'facet' in the configuration array.");
     }
     /** @var \Drupal\facets\FacetInterface $facet */
     $facet = $configuration['facet'];
     /** @var \Drupal\facets\FacetSourceInterface $fs */
     $fs = $facet->getFacetSourceConfig();
     $url_processor_name = $fs->getUrlProcessorName();
     $manager = \Drupal::getContainer()->get('plugin.manager.facets.url_processor');
     $this->processor = $manager->createInstance($url_processor_name, ['facet' => $facet]);
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigManagerInterface $config_manager, EntityFieldManagerInterface $entity_field_manager)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->configManager = $config_manager;
     $this->entityFieldManager = $entity_field_manager;
 }