protected function PluginRevisionController::buildLayoutNavigation in Diff 8
Builds a navigation dropdown button between the layout plugins.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity to be compared.
int $left_revision_id: Revision id of the left revision.
int $right_revision_id: Revision id of the right revision.
string $active_filter: The active filter.
Return value
array The layout filter.
1 call to PluginRevisionController::buildLayoutNavigation()
- PluginRevisionController::compareEntityRevisions in src/
Controller/ PluginRevisionController.php - Returns a table which shows the differences between two entity revisions.
File
- src/
Controller/ PluginRevisionController.php, line 194
Class
- PluginRevisionController
- Base class for controllers that return responses on entity revision routes.
Namespace
Drupal\diff\ControllerCode
protected function buildLayoutNavigation(ContentEntityInterface $entity, $left_revision_id, $right_revision_id, $active_filter) {
$links = [];
$layouts = $this->diffLayoutManager
->getPluginOptions();
foreach ($layouts as $key => $value) {
$links[$key] = array(
'title' => $value,
'url' => $this
->diffRoute($entity, $left_revision_id, $right_revision_id, $key),
);
}
// Set as the first element the current filter.
$filter = $links[$active_filter];
unset($links[$active_filter]);
array_unshift($links, $filter);
$filter = [
'#type' => 'operations',
'#links' => $links,
];
return $filter;
}