gridstack-8.x-2.5/modules/gridstack_ui/gridstack_ui.module
modules/gridstack_ui/gridstack_ui.module
<?php
/**
* @file
* Provides GridStack configuration entity UI.
*/
/**
* Implements hook_theme().
*/
function gridstack_ui_theme() {
$themes = [];
foreach (['admin', 'dummy'] as $item) {
$themes['gridstack_ui_' . $item] = [
'render element' => 'element',
'file' => 'templates/gridstack_ui.theme.inc',
];
}
return $themes;
}
/**
* Implements hook_entity_type_build().
*/
function gridstack_ui_entity_type_build(array &$entity_types) {
/* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$gridstack = $entity_types['gridstack'];
$gridstack->setListBuilderClass('Drupal\gridstack_ui\Controller\GridStackListBuilder');
$gridstack->setFormClass('add', 'Drupal\gridstack_ui\Form\GridStackForm');
$gridstack->setFormClass('edit', 'Drupal\gridstack_ui\Form\GridStackForm');
$gridstack->setFormClass('delete', 'Drupal\gridstack_ui\Form\GridStackDeleteForm');
$gridstack->setFormClass('duplicate', 'Drupal\gridstack_ui\Form\GridStackForm');
$gridstack->set('admin_permission', 'administer gridstack');
$gridstack->setLinkTemplate('add-form', '/admin/structure/gridstack/add');
$gridstack->setLinkTemplate('edit-form', '/admin/structure/gridstack/{gridstack}');
$gridstack->setLinkTemplate('delete-form', '/admin/structure/gridstack/{gridstack}/delete');
$gridstack->setLinkTemplate('duplicate-form', '/admin/structure/gridstack/{gridstack}/duplicate');
$gridstack->setLinkTemplate('collection', '/admin/structure/gridstack');
}
/**
* Implements hook_help().
*/
function gridstack_ui_help($route_name) {
if ($route_name == 'help.page.gridstack_ui') {
$output = file_get_contents(dirname(dirname(dirname(__FILE__))) . '/docs/README.md');
foreach (['CONFIGURATION', 'TROUBLESHOOTING', 'FAQ', 'ROADMAP'] as $key) {
$output .= file_get_contents(dirname(dirname(dirname(__FILE__))) . "/docs/{$key}.md");
}
return function_exists('blazy_parse_markdown') ? blazy_parse_markdown($output) : '<pre>' . $output . '</pre>';
}
return '';
}
