getTranslatableData example


  public function getTranslatableDefaultConfig($name) {
    if ($this->isSupported($name)) {
      // Create typed configuration wrapper based on install storage data.       $data = $this->defaultConfigStorage->read($name);
      $typed_config = $this->typedConfigManager->createFromNameAndData($name$data);
      if ($typed_config instanceof TraversableTypedDataInterface) {
        return $this->getTranslatableData($typed_config);
      }
    }
    return [];
  }

  /** * Gets translatable configuration data for a typed configuration element. * * @param \Drupal\Core\TypedData\TypedDataInterface $element * Typed configuration element. * * @return array|\Drupal\Core\StringTranslation\TranslatableMarkup * A nested array matching the exact structure under $element with only the * elements that are translatable wrapped into a TranslatableMarkup. If the * provided $element is not traversable, the return value is a single * TranslatableMarkup. */
Home | Imprint | This part of the site doesn't use cookies.