ckeditor_bs_grid.module in CKEditor Bootstrap Grid 2.0.x
Same filename and directory in other branches
Contains ckeditor_bs_grid.module..
File
ckeditor_bs_grid.moduleView source
<?php
/**
* @file
* Contains ckeditor_bs_grid.module..
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function ckeditor_bs_grid_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the ckeditor_bs_grid module.
case 'help.page.ckeditor_bs_grid':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Ckeditor plugin for Bootstrap Grid') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function ckeditor_bs_grid_theme($existing, $type, $theme, $path) {
return [
'form_element_label__bs_grid_option' => [
'base hook' => 'form_element_label',
'template' => 'form-element-label-bs-grid-option',
],
];
}
/**
* Implements hook_preprocess_HOOK().
*/
function ckeditor_bs_grid_preprocess_form_element(&$variables) {
// if the flag is available we use a special function to render the label.
if (array_key_exists('data-bs-grid-option', $variables['element']['#attributes'])) {
$variables['attributes']['class'] = $variables['attributes']['class'] ?? [];
$variables['attributes']['class'] += [
'd-block',
'm-0',
'bs-grid-option',
];
$variables['label']['#theme'] = 'form_element_label__bs_grid_option';
$variables['label']['bs_option_value'] = $variables['element']['#return_value'];
}
}
/**
* Implements hook_preprocess_HOOK().
*/
function ckeditor_bs_grid_preprocess_form_element_label(&$variables) {
if (!empty($variables['element']['bs_option_value'])) {
$variables['bs_option_values'] = explode('_', $variables['element']['bs_option_value']);
}
}
Functions
Name | Description |
---|---|
ckeditor_bs_grid_help | Implements hook_help(). |
ckeditor_bs_grid_preprocess_form_element | Implements hook_preprocess_HOOK(). |
ckeditor_bs_grid_preprocess_form_element_label | Implements hook_preprocess_HOOK(). |
ckeditor_bs_grid_theme | Implements hook_theme(). |