final class ViewsQuerySubstitutionsEvent in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/views_event_dispatcher/src/Event/Views/ViewsQuerySubstitutionsEvent.php \Drupal\views_event_dispatcher\Event\Views\ViewsQuerySubstitutionsEvent
Class ViewsQuerySubstitutionEvent.
Hierarchy
- class \Drupal\views_event_dispatcher\Event\Views\AbstractViewsEvent extends \Symfony\Component\EventDispatcher\Event implements EventInterface
- class \Drupal\views_event_dispatcher\Event\Views\ViewsQuerySubstitutionsEvent
Expanded class hierarchy of ViewsQuerySubstitutionsEvent
3 files declare their use of ViewsQuerySubstitutionsEvent
- ExampleViewsEventSubscribers.php in examples/
ExampleViewsEventSubscribers.php - ViewEventTest.php in modules/
views_event_dispatcher/ tests/ src/ Unit/ Views/ ViewEventTest.php - views_event_dispatcher.module in modules/
views_event_dispatcher/ views_event_dispatcher.module - Views event dispatcher submodule.
File
- modules/
views_event_dispatcher/ src/ Event/ Views/ ViewsQuerySubstitutionsEvent.php, line 10
Namespace
Drupal\views_event_dispatcher\Event\ViewsView source
final class ViewsQuerySubstitutionsEvent extends AbstractViewsEvent {
/**
* Views query substitutions.
*
* @var array
*/
private $substitutions = [];
/**
* Get the query substitutions.
*
* @return array
* An associative array where each key is a string to be replaced, and the
* corresponding value is its replacement. The strings to replace are often
* surrounded with '***', as illustrated in the example implementation, to
* avoid collisions with other values in the query.
*/
public function &getSubstitutions() : array {
return $this->substitutions;
}
/**
* Add a substitution.
*
* @param string $target
* String target to be replaced.
* @param string $replacement
* The replacement of the given target.
*/
public function addSubstitution(string $target, string $replacement) : void {
$this->substitutions[$target] = $replacement;
}
/**
* Get the dispatcher type.
*
* @return string
* The dispatcher type.
*/
public function getDispatcherType() : string {
return HookEventDispatcherInterface::VIEWS_QUERY_SUBSTITUTIONS;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractViewsEvent:: |
private | property | The view. | |
AbstractViewsEvent:: |
public | function | Get the view. | |
AbstractViewsEvent:: |
public | function | AbstractViewsEvent constructor. | 3 |
ViewsQuerySubstitutionsEvent:: |
private | property | Views query substitutions. | |
ViewsQuerySubstitutionsEvent:: |
public | function | Add a substitution. | |
ViewsQuerySubstitutionsEvent:: |
public | function |
Get the dispatcher type. Overrides EventInterface:: |
|
ViewsQuerySubstitutionsEvent:: |
public | function | Get the query substitutions. |