class LocaleTestTranslateHooks

Hook implementations for locale_test_translate.

Hierarchy

Expanded class hierarchy of LocaleTestTranslateHooks

File

core/modules/locale/tests/modules/locale_test_translate/src/Hook/LocaleTestTranslateHooks.php, line 13

Namespace

Drupal\locale_test_translate\Hook
View source
class LocaleTestTranslateHooks {
    
    /**
     * Implements hook_system_info_alter().
     *
     * By default this modules is hidden but once enabled it behaves like a normal
     * (not hidden) module. This hook implementation changes the .info.yml data by
     * setting the hidden status to FALSE.
     */
    public function systemInfoAlter(&$info, Extension $file, $type) : void {
        if ($file->getName() == 'locale_test_translate') {
            // Don't hide the module.
            $info['hidden'] = FALSE;
        }
    }
    
    /**
     * Implements hook_modules_installed().
     *
     * @see \Drupal\Tests\locale\Functional\LocaleConfigTranslationImportTest::testConfigTranslationWithForeignLanguageDefault
     */
    public function modulesInstalled($modules, $is_syncing) : void {
        // Ensure that writing to configuration during install does not cause
        // \Drupal\locale\LocaleConfigSubscriber to create incorrect translations due
        // the configuration langcode and data being out-of-sync.
        \Drupal::configFactory()->getEditable('locale_test_translate.settings')
            ->set('key_set_during_install', TRUE)
            ->save();
    }

}

Members

Title Sort descending Modifiers Object type Summary
LocaleTestTranslateHooks::modulesInstalled public function Implements hook_modules_installed().
LocaleTestTranslateHooks::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.