localgov_microsites_group-4.1.0/modules/localgov_microsites_directories/localgov_microsites_directories.install
modules/localgov_microsites_directories/localgov_microsites_directories.install
<?php
/**
* @file
* LocalGov Microsites Directories install file.
*/
use Drupal\search_api\Entity\Index;
/**
* Implements hook_install().
*/
function localgov_microsites_directories_install($is_syncing) {
// Enabled the directories DB backend after installing dependencies.
\Drupal::service('module_installer')->install(['localgov_directories_db']);
if ($is_syncing) {
return;
}
// Add domain access to exclude other sites results.
$index = Index::load('localgov_directories_index_default');
$processor = \Drupal::getContainer()
->get('search_api.plugin_helper')
->createProcessorPlugin($index, 'domain_group_entity_access');
$index->addProcessor($processor);
$index->save();
// Create field_group for page_top section.
$group_view_page_bottom = new stdClass();
$group_view_page_bottom->group_name = 'group_page_bottom';
$group_view_page_bottom->context = 'view';
$group_view_page_bottom->entity_type = 'node';
$group_view_page_bottom->bundle = 'localgov_directory_promo_page';
$group_view_page_bottom->mode = 'default';
$group_view_page_bottom->label = 'Page bottom';
$group_view_page_bottom->region = 'content';
$group_view_page_bottom->parent_name = '';
$group_view_page_bottom->weight = '0';
$group_view_page_bottom->children = [
'group_enquiries',
];
$group_view_page_bottom->format_type = 'html_element';
$group_view_page_bottom->format_settings = [
'classes' => 'full__page-bottom',
'show_empty_fields' => FALSE,
'id' => '',
'element' => 'div',
'show_label' => FALSE,
'label_element' => 'h3',
'label_element_classes' => '',
'attributes' => '',
'effect' => 'none',
'speed' => 'fast',
];
field_group_group_save($group_view_page_bottom);
}
