TextFormat.php in Drupal 10
File
core/modules/config_translation/src/FormElement/TextFormat.php
View source
<?php
namespace Drupal\config_translation\FormElement;
use Drupal\Core\Language\LanguageInterface;
class TextFormat extends FormElementBase {
public function getSourceElement(LanguageInterface $source_language, $source_config) {
return $this
->getTranslationElement($source_language, $source_config, $source_config) + [
'#value' => $source_config['value'],
'#disabled' => TRUE,
'#allow_focus' => TRUE,
];
}
public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
return [
'#type' => 'text_format',
'#default_value' => $translation_config['value'],
'#format' => $translation_config['format'],
'#allowed_formats' => [
$source_config['format'],
],
] + parent::getTranslationElement($translation_language, $source_config, $translation_config);
}
}
Classes
Name |
Description |
TextFormat |
Defines the text_format element for the configuration translation interface. |