buildDataDefinition example


  protected function getElementDefinition($key) {
    $value = $this->value[$key] ?? NULL;
    // @todo: Remove BC layer for sequence with hyphen in front. https://www.drupal.org/node/2444979     $definition = [];
    if (isset($this->definition['sequence'][0])) {
      $definition = $this->definition['sequence'][0];
    }
    elseif ($this->definition['sequence']) {
      $definition = $this->definition['sequence'];
    }
    return $this->buildDataDefinition($definition$value$key);
  }

}

  protected function buildDataDefinition($definition$value$key) {
    return $this->getTypedDataManager()->buildDataDefinition($definition$value$key$this);
  }

  /** * Determines if this element allows NULL as a value. * * @return bool * TRUE if NULL is a valid value, FALSE otherwise. */
  public function isNullable() {
    return isset($this->definition['nullable']) && $this->definition['nullable'] == TRUE;
  }

  
parent::processDefinition($definition$plugin_id);

    if (!isset($definition['base_route_name'])) {
      throw new InvalidPluginDefinitionException($plugin_id, "The plugin definition of the mapper '$plugin_id' does not contain a base_route_name.");
    }
  }

  /** * {@inheritdoc} */
  public function buildDataDefinition(array $definition$value = NULL, $name = NULL, $parent = NULL) {
    return $this->typedConfigManager->buildDataDefinition($definition$value$name$parent);
  }

  /** * {@inheritdoc} */
  protected function findDefinitions() {
    $definitions = $this->getDiscovery()->getDefinitions();
    foreach ($definitions as $plugin_id => &$definition) {
      $this->processDefinition($definition$plugin_id);
    }
    if ($this->alterHook) {
      
$message = "Invoking hook_config_schema_info_alter() has removed ($removed_keys) schema definitions";
      }
      throw new ConfigSchemaAlterException($message);
    }
  }

  /** * {@inheritdoc} */
  public function createFromNameAndData($config_name, array $config_data) {
    $definition = $this->getDefinition($config_name);
    $data_definition = $this->buildDataDefinition($definition$config_data);
    return $this->create($data_definition$config_data$config_name);
  }

}

class Mapping extends ArrayElement {

  /** * {@inheritdoc} */
  protected function getElementDefinition($key) {
    $value = $this->value[$key] ?? NULL;
    $definition = $this->definition['mapping'][$key] ?? [];
    return $this->buildDataDefinition($definition$value$key);
  }

}
Home | Imprint | This part of the site doesn't use cookies.