You are here

gridstack_ui.module in GridStack 8

Same filename and directory in other branches
  1. 8.2 modules/gridstack_ui/gridstack_ui.module

Provides GridStack configuration entity UI.

File

modules/gridstack_ui/gridstack_ui.module
View source
<?php

/**
 * @file
 * Provides GridStack configuration entity UI.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * 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, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.gridstack_ui':
      return check_markup(file_get_contents(dirname(dirname(__DIR__)) . '/README.txt'), 'restricted_html');
  }
}

Functions