You are here

cms_events.install in Glazed CMS Events 8

Same filename and directory in other branches
  1. 7 cms_events.install

Install, update and uninstall functions for the CMS Events module.

File

cms_events.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the CMS Events module.
 */
use Drupal\block\Entity\Block;

/**
 * Implements hook_install().
 */
function cms_events_install() {
  $default_theme = Drupal::config('system.theme')
    ->get('default');
  Block::create([
    'id' => 'views_block__cms_events_monthly_archive',
    'plugin' => 'views_block:cms_events-monthly_archive',
    'theme' => $default_theme,
    'status' => TRUE,
    'region' => 'sidebar_second',
    'settings' => [
      'id' => 'views_block:cms_events-monthly_archive',
      'label' => '',
      'provider' => 'views',
      'label_display' => 'visible',
      'views_label' => '',
      'items_per_page' => 'none',
    ],
    'visibility' => [
      'request_path' => [
        'id' => 'request_path',
        'pages' => implode("\n", [
          '/events',
          '/events/*',
          '/events-archive',
          'events-archive/*',
        ]),
        'negate' => FALSE,
      ],
    ],
    'dependencies' => [
      'enforced' => [
        'module' => [
          'cms_events',
        ],
      ],
    ],
  ])
    ->save();
}

Functions

Namesort descending Description
cms_events_install Implements hook_install().