12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- use Drupal\Core\Form\FormStateInterface;
- use Drupal\Core\Routing\RouteMatchInterface;
- /**
- * Implements hook_help().
- */
- function permissions_filter_help($route_name, RouteMatchInterface $route_match) {
- switch ($route_name) {
- // Main module help for the permissions_filter module.
- case 'help.page.permissions_filter':
- $output = '';
- $output .= '<h3>' . t('About') . '</h3>';
- $output .= '<p>' . t('Create a filter for permission page.') . '</p>';
- return $output;
- default:
- }
- }
- /**
- * Implements hook_form_alter() on behalf of permissions_filter.module.
- */
- function permissions_filter_form_alter(&$form, FormStateInterface $form_state, $form_id) {
- if ($form_id == 'user_admin_permissions') {
- $form['filters'] = array(
- '#type' => 'container',
- '#attributes' => array(
- 'class' => array('table-filter', 'js-show'),
- ),
- '#weight' => -1,
- );
- $form['filters']['search_permission'] = array(
- '#type' => 'search',
- '#title' => t('Enter a part of the Permission name or description'),
- '#title_display' => 'invisible',
- '#size' => 30,
- '#placeholder' => t('Filter by name or description'),
- '#description' => t('Enter a part of the permission'),
- '#attributes' => array(
- 'class' => array('table-filter-text'),
- 'data-table' => '#user-admin-permissions',
- 'autocomplete' => 'off',
- ),
- );
- $form['#attached']['library'][] = 'permissions_filter/permissions_js';
- }
- }
|