Skip to content
Snippets Groups Projects

added hook help

Open Himanshu Jhaloya requested to merge issue/node_access_grants-3358841:hook_help into 8.x-2.x
1 file
+ 17
0
Compare changes
  • Side-by-side
  • Inline
+ 17
0
@@ -2,6 +2,7 @@
use Drupal\Core\Session\AccountInterface;
use Drupal\node\NodeInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_node_grants().
@@ -19,4 +20,20 @@ function node_access_grants_node_access_records(NodeInterface $node) {
/** @var \Drupal\node_access_grants\NodeAccessGrantsInterface $collection */
$collection = \Drupal::service('node_access_grants.collection');
return $collection->accessRecords($node);
}
/**
* Implements hook_help().
*/
function node_access_grants_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.node_access_grants':
$filepath = dirname(__FILE__) . '/README.md';
if (file_exists($filepath)) {
$readme = file_get_contents($filepath);
$output = '<pre>' . $readme . '</pre>';
return $output;
}
}
}
\ No newline at end of file
Loading