You are here

function cms_blog_install in Glazed CMS Blog 8

Same name and namespace in other branches
  1. 7 cms_blog.install \cms_blog_install()

Implements hook_install().

File

./cms_blog.install, line 13
Install, update and uninstall functions for the CMS Blog module.

Code

function cms_blog_install() {
  $default_theme = Drupal::config('system.theme')
    ->get('default');
  $defaults = [
    'theme' => $default_theme,
    'status' => TRUE,
    'region' => 'sidebar_second',
    'visibility' => [
      'request_path' => [
        'id' => 'request_path',
        'pages' => implode("\n", [
          '/blog',
          '/blog/*',
          '/tags/*',
        ]),
        'negate' => FALSE,
      ],
    ],
    'dependencies' => [
      'enforced' => [
        'module' => [
          'cms_blog',
        ],
      ],
    ],
  ];
  Block::create($defaults + [
    'id' => 'views_block.cms_blog_authors_block',
    'plugin' => 'views_block:cms_blog_authors-block',
    'settings' => [
      'id' => 'views_block:cms_blog_authors_block',
      'label' => '',
      'provider' => 'views',
      'label_display' => 'visible',
      'views_label' => '',
      'items_per_page' => 'none',
    ],
  ])
    ->save();
  Block::create($defaults + [
    'id' => 'cms_blog_tags',
    'plugin' => 'tagclouds_block:cms_blog_tags',
    'settings' => [
      'id' => 'tagclouds_block:cms_blog_tags',
      'label' => 'Tags',
      'provider' => 'tagclouds',
      'label_display' => 'visible',
      'tags' => 12,
      'vocabulary' => 'cms_blog_tags',
    ],
  ])
    ->save();
  Block::create($defaults + [
    'id' => 'views_block.cms_blog_categories_block',
    'plugin' => 'views_block:cms_blog_categories-block',
    'settings' => [
      'id' => 'views_block:cms_blog_categories_block',
      'label' => '',
      'provider' => 'views',
      'label_display' => 'visible',
      'views_label' => '',
      'items_per_page' => 'none',
    ],
  ])
    ->save();
}