ConfigTranslationFormBase::createFormElement

public static ConfigTranslationFormBase::createFormElement(TypedDataInterface $schema)

Creates a form element builder.

Parameters

\Drupal\Core\TypedData\TypedDataInterface $schema: Schema definition of configuration.

Return value

\Drupal\config_translation\FormElement\ElementInterface|null The element builder object if possible.

File

core/modules/config_translation/src/Form/ConfigTranslationFormBase.php, line 235

Class

ConfigTranslationFormBase
Provides a base form for configuration translations.

Namespace

Drupal\config_translation\Form

Code

public static function createFormElement(TypedDataInterface $schema) {
  $definition = $schema->getDataDefinition();
  // Form element classes can be specified even for non-translatable elements
  // such as the ListElement form element which is used for Mapping and
  // Sequence schema elements.
  if (isset($definition['form_element_class'])) {
    if (!$definition->getLabel()) {
      $definition->setLabel(t('n/a'));
    }
    $class = $definition['form_element_class'];
    return $class::create($schema);
  }
}
doc_Drupal
2016-10-29 08:54:59
Comments
Leave a Comment

Please login to continue.