mdrop_suite-1.0.0-alpha1/modules/mdrop_suite_modal/mdrop_suite_modal.module
modules/mdrop_suite_modal/mdrop_suite_modal.module
<?php
/**
* @file
* Primary module hooks for Mdrop Suite - Modal module.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\mdrop_suite_modal\MdropSuiteModalLayoutBuilderPreRender;
/**
* Implements hook_library_info_build().
*/
function mdrop_suite_modal_library_info_build() {
return \Drupal::service('mdrop_suite_modal.helper')->getAdminInheritedLibraries();
}
/**
* Implements hook_link_alter().
*/
function mdrop_suite_modal_link_alter(&$variables) {
\Drupal::service('mdrop_suite_modal.helper')->layoutBuilderLinkAlter($variables);
}
/**
* Implements hook_contextual_links_alter().
*/
function mdrop_suite_modal_contextual_links_alter(array &$links) {
\Drupal::service('mdrop_suite_modal.helper')->layoutBuilderContextualLinksAlter($links);
}
/**
* Implements hook_element_info_alter().
*/
function mdrop_suite_modal_element_info_alter(array &$types) {
if (isset($types['layout_builder'])) {
$types['layout_builder']['#pre_render'][] = [
MdropSuiteModalLayoutBuilderPreRender::class,
'preRender',
];
}
}
/**
* Implements hook_module_implements_alter().
*/
function mdrop_suite_modal_module_implements_alter(&$implementations, $hook) {
switch ($hook) {
case 'element_info_alter':
$group = $implementations['mdrop_suite_modal'];
unset($implementations['mdrop_suite_modal']);
$implementations['mdrop_suite_modal'] = $group;
break;
}
}
/**
* Implements hook_form_alter().
*/
function mdrop_suite_modal_form_alter(&$form, FormStateInterface $form_state) {
\Drupal::service('mdrop_suite_modal.helper')->alterLayoutBuilderMainForm($form, $form_state);
\Drupal::service('mdrop_suite_modal.helper')->alterLayoutBuilderModalForm($form, $form_state);
}
