Commit d0393ab4 authored by vuil's avatar vuil Committed by ilcho.vuchkov

Issue #3087769 by vuil: Apply coding standards

parent c33e5dfd
......@@ -8,7 +8,7 @@
- [Drush](#drush)
## Introduction
## INTRODUCTION
Current Maintainer: [TravisCarden](https://www.drupal.org/u/traviscarden)
......@@ -17,13 +17,13 @@ persistent checklists that track progress with completion times and users. See
checklistapi_example.module for an example implementation.
## Installation
## INSTALLATION
Checklist API is installed in the usual way. See [Installing contributed
modules](https://www.drupal.org/documentation/install/modules-themes/modules-8).
## Implementation
## REQUIREMENTS & IMPLEMENTATIONS
Checklists are declared as multidimensional arrays using
`hook_checklistapi_checklist_info()`. They can be altered using
......@@ -31,6 +31,8 @@ Checklists are declared as multidimensional arrays using
menu items and permissions. Progress details are saved in one config file per
checklist.
## CONFIGURATION
See checklistapi.api.php for more details.
......
......@@ -5,7 +5,9 @@
* An example implementation of the Checklist API.
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\checklistapi\ChecklistapiChecklist;
/**
* Implements hook_checklistapi_checklist_info().
......@@ -299,3 +301,23 @@ function checklistapiexample_checklistapi_checklist_info_alter(&$definitions) {
],
];
}
/**
* Implements hook_help().
*/
function checklistapiexample_help($route_name, RouteMatchInterface $route_match) {
foreach (checklistapi_get_checklist_info() as $id => $definition) {
$checklist = new ChecklistapiChecklist($definition);
if ($checklist->getRouteName() == $route_name) {
// The checklist has help and the current user has access to view it.
if (!empty($definition['#help']) && checklistapi_checklist_access($id)) {
return $definition['#help'];
}
// Otherwise the loop can break early since only one checklist can occupy
// a given route.
else {
break;
}
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment