class ConfigTranslationTestHooks
Hook implementations for config_translation_test.
Hierarchy
- class \Drupal\config_translation_test\Hook\ConfigTranslationTestHooks
Expanded class hierarchy of ConfigTranslationTestHooks
File
-
core/
modules/ config_translation/ tests/ modules/ config_translation_test/ src/ Hook/ ConfigTranslationTestHooks.php, line 14
Namespace
Drupal\config_translation_test\HookView source
class ConfigTranslationTestHooks {
/**
* Implements hook_system_info_alter().
*/
public function systemInfoAlter(array &$info, Extension $file, $type) : void {
// @see \Drupal\config_translation\Tests\ConfigTranslationUiThemeTest
if ($file->getType() == 'theme' && $file->getName() == 'config_translation_test_theme') {
$info['hidden'] = FALSE;
}
}
/**
* Implements hook_entity_type_alter().
*/
public function entityTypeAlter(array &$entity_types) : void {
// Remove entity definition for these entity types from config_test module.
unset($entity_types['config_test_no_status']);
unset($entity_types['config_query_test']);
}
/**
* Implements hook_config_translation_info_alter().
*/
public function configTranslationInfoAlter(&$info) : void {
if (\Drupal::state()->get('config_translation_test_config_translation_info_alter')) {
// Limit account settings config files to only one of them.
$info['entity.user.admin_form']['names'] = [
'user.settings',
];
// Add one more config file to the site information page.
$info['system.site_information_settings']['names'][] = 'system.rss';
}
}
/**
* Implements hook_form_BASE_FORM_ID_alter() for ConfigTranslationFormBase.
*
* Adds a list of configuration names to the top of the configuration
* translation form.
*
* @see \Drupal\config_translation\Form\ConfigTranslationFormBase
*/
public function formConfigTranslationFormAlter(&$form, FormStateInterface $form_state) : void {
if (\Drupal::state()->get('config_translation_test_alter_form_alter')) {
$form['#base_altered'] = TRUE;
}
}
/**
* Implements hook_form_FORM_ID_alter() for ConfigTranslationAddForm.
*
* Changes the title to include the source language.
*
* @see \Drupal\config_translation\Form\ConfigTranslationAddForm
*/
public function formConfigTranslationAddFormAlter(&$form, FormStateInterface $form_state) : void {
if (\Drupal::state()->get('config_translation_test_alter_form_alter')) {
$form['#altered'] = TRUE;
}
}
/**
* Implements hook_form_FORM_ID_alter() for ConfigTranslationEditForm.
*
* Adds a column to the configuration translation edit form that shows the
* current translation. Note that this column would not be displayed by default,
* as the columns are hardcoded in
* config_translation_manage_form_element.html.twig. The template would need to
* be overridden for the column to be displayed.
*
* @see \Drupal\config_translation\Form\ConfigTranslationEditForm
*/
public function formConfigTranslationEditFormAlter(&$form, FormStateInterface $form_state) : void {
if (\Drupal::state()->get('config_translation_test_alter_form_alter')) {
$form['#altered'] = TRUE;
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ConfigTranslationTestHooks::configTranslationInfoAlter | public | function | Implements hook_config_translation_info_alter(). |
ConfigTranslationTestHooks::entityTypeAlter | public | function | Implements hook_entity_type_alter(). |
ConfigTranslationTestHooks::formConfigTranslationAddFormAlter | public | function | Implements hook_form_FORM_ID_alter() for ConfigTranslationAddForm. |
ConfigTranslationTestHooks::formConfigTranslationEditFormAlter | public | function | Implements hook_form_FORM_ID_alter() for ConfigTranslationEditForm. |
ConfigTranslationTestHooks::formConfigTranslationFormAlter | public | function | Implements hook_form_BASE_FORM_ID_alter() for ConfigTranslationFormBase. |
ConfigTranslationTestHooks::systemInfoAlter | public | function | Implements hook_system_info_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.