ztools-1.0.x-dev/ztools.module
ztools.module
<?php
/**
* Implements hook_element_info_alter().
*/
function ztools_element_info_alter(array &$info) {
if (!empty($info['submit'])) {
$info['submit']['#after_build'][] = 'ztools_after_build_button';
}
if (!empty($info['button'])) {
$info['button']['#after_build'][] = 'ztools_after_build_button';
}
}
function ztools_after_build_button($element, &$form_state) {
if (!empty($element['#prevent_double_click'])) {
$element['#attached']['library'][] = 'ztools/prevent-double-click';
$element['#attributes']['data-ztools-prevent-double-click'] = 'true';
if (!empty($element['#without_disable'])) {
$element['#attributes']['data-ztools-without-disable'] = 'true';
}
}
return $element;
}
/**
* Implements hook_views_data_alter().
*/
function ztools_views_data_alter(array &$data) {
foreach ($data as $table => $table_data) {
if (!empty($table_data['operations']) || $table === 'search_api_index_content') {
$data[$table]['ztools_operations_links'] = [
'field' => [
'title' => t('Operations links as separate links'),
'help' => t('Operations links as separate links.'),
'id' => 'ztools_entity_operations_links',
],
];
}
}
}
