When I'm trying to extend the module's ViewsFiltersSummary ViewsArea plugin just to override some functions, for example, buildFilterSummaryItem() - this doesn't work, the parent function is called instead of the function in the overridden class.
1. Extend the class like this:
class MUViewsFiltersSummary extends ViewsFiltersSummary {
...
}
2. Override a function like this:
protected function buildFilterSummaryItem(
string $id,
string $label,
string $value,
string|int|null $value_raw = NULL,
): array {
$item = parent::buildFilterSummaryItem($id, $label, $value, $value_raw);
$item['value'] = 'Test';
return $item;
3. Add this plugin to a view area, and see that this doesn't work.
The issue is that the original plugin class uses "self" instead of "static" in the method create():
/**
* {@inheritdoc}
*/
public static function create(
ContainerInterface $container,
array $configuration,
$plugin_id,
$plugin_definition,
) {
return new self(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('string_translation'),
$container->get('entity_type.manager'),
$container->get('entity_type.bundle.info'),
$container->get('logger.factory'),
$container->get('language_manager')
);
}
Changing "self" to "static" resolves the issue.
Fixed
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.