You are here

search_config.install in Search configuration 8

Same filename and directory in other branches
  1. 6 search_config.install
  2. 7 search_config.install

Install, update and uninstall functions for the search_config module.

File

search_config.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the search_config module.
 */
use Drupal\user\RoleInterface;

/**
 * Implements hook_schema().
 */
function search_config_schema() {
  $schema['search_config_exclude'] = [
    'description' => 'Provides a way to exclude specific entities from the search results. Note that this does not stop the entities from being indexed.',
    'fields' => [
      'entity_id' => [
        'description' => 'The node Id to exclude.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'entity_type' => [
        'description' => 'The entity type to exclude.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'exclude' => [
        'description' => 'Exclusion flag. Default 1: exclude from public searches.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
      ],
    ],
    'primary key' => [
      'entity_id',
      'entity_type',
    ],
  ];
  return $schema;
}

/*
 * Implements hook_install()
 */
function search_config_install() {
  user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
    'search all content',
  ]);
  user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, [
    'search all content',
  ]);
}

Functions