Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function operators()
 {
     $operators = parent::operators();
     // @todo Enable "(not) between" again once that operator is available in
     //   the Search API.
     unset($operators['between'], $operators['not between'], $operators['regular_expression']);
     return $operators;
 }
Exemplo n.º 2
0
 /**
  * Constructs a new Date handler.
  *
  * @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 \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
  *   The date formatter service.
  * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
  *   The request stack used to determine the current time.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatterInterface $date_formatter, RequestStack $request_stack)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->dateFormatter = $date_formatter;
     $this->requestStack = $request_stack;
     // Date format depends on field storage format.
     $definition = $this->getFieldStorageDefinition();
     if ($definition->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
         $this->dateFormat = DATETIME_DATE_STORAGE_FORMAT;
     }
 }