class ViewsBadge in Link Badges 8
Same name in this branch
- 8 src/Plugin/LinkBadge/ViewsBadge.php \Drupal\link_badges\Plugin\LinkBadge\ViewsBadge
- 8 src/Plugin/Derivative/ViewsBadge.php \Drupal\link_badges\Plugin\Derivative\ViewsBadge
Views-based Link Badges
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\link_badges\Plugin\Derivative\ViewsBadge
Expanded class hierarchy of ViewsBadge
File
- src/
Plugin/ Derivative/ ViewsBadge.php, line 11
Namespace
Drupal\link_badges\Plugin\DerivativeView source
class ViewsBadge extends DeriverBase {
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$badge_views = Views::getApplicableViews('uses_link_badge');
foreach ($badge_views as $data) {
list($view_id, $display_id) = $data;
$view = Views::getView($view_id);
$display = $view
->getDisplay($display_id);
$id = $view->storage
->id() . ':' . $display_id;
$this->derivatives[$id] = $base_plugin_definition;
$this->derivatives[$id] += array(
'properties' => array(
'name' => $view->storage
->id(),
'display_id' => $display_id,
),
'label' => $view->storage
->label() . ': ' . $display->options['title'],
);
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
ViewsBadge:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |