The verf_entites_options alter hook currently only receives the list of referenceable entities:

$this->moduleHandler->alter('verf_entites_options', $referenceable_entities);

This makes it difficult to determine which VERF filter is currently being altered when multiple VERF filters are used on a site.

For example, a site may have several VERF filters targeting the same entity type or bundles, but with different purposes. The alter hook cannot currently distinguish between them because no information about the filter, its configuration, or the View is provided.

It would be useful if the hook exposed some context about the current VERF filter, for example the filter plugin itself or its configuration:

$this->moduleHandler->alter(
'verf_entites_options',
$referenceable_entities,
$this,
);

This would allow implementations of hook_verf_entites_options_alter() to target a specific filter or View without having to rely on global assumptions or modify/override the VERF plugin.

A concrete use case is filtering the available entities based on how they are used elsewhere on the site, but only for one specific VERF filter. With the current hook signature, this cannot be done reliably when multiple VERF filters are present.

CommentFileSizeAuthor
#4 3626451.patch648 bytesfabsgugu
#2 3626451.diff648 bytesfabsgugu

Issue fork verf-3626451

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

    Comments

    fabsgugu created an issue. See original summary.

    fabsgugu’s picture

    StatusFileSize
    new648 bytes
    fabsgugu’s picture

    fabsgugu’s picture

    StatusFileSize
    new648 bytes