link_attributes_test_alterinfo.module in Link Attributes widget 8
Link attributes test module.
File
tests/modules/link_attributes_test_alterinfo/link_attributes_test_alterinfo.moduleView source
<?php
/**
* @file
* Link attributes test module.
*/
/**
* Implements hook_link_attributes_plugin_alter().
*/
function link_attributes_test_alterinfo_link_attributes_plugin_alter(array &$definitions) {
// Alter only if our state flag is set.
if (\Drupal::state()
->get('link_attributes_test_alterinfo.hook_link_attributes_plugin_alter')) {
$definitions['class']['title'] = t('Link style');
$definitions['class']['description'] = t('Select how the link should be displayed.');
$definitions['class']['type'] = 'select';
$definitions['class']['options'] = [
'link' => 'Link',
'button' => 'Button',
];
$definitions['class']['default_value'] = 'button';
$definitions['target']['default_value'] = '_blank';
}
}
Functions
Name | Description |
---|---|
link_attributes_test_alterinfo_link_attributes_plugin_alter | Implements hook_link_attributes_plugin_alter(). |