Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
/**
* Create typed config object.
*/
protected function parseElement($key, $data, $definition) {
return \Drupal::service('config.typed')->create($definition, $data, $key, $this);
}
/**
* Build data definition object for contained elements.
*
* @return \Drupal\Core\TypedData\DataDefinitionInterface
*/
protected function buildDataDefinition($definition, $value, $key) {
return \Drupal::service('config.typed')->buildDataDefinition($definition, $value, $key, $this);
}
This means that only the container's version of the typed config manager can ever be used.
We should inject the typed config manager when the typed config manager creates instances. This is a refactor - test coverage of schema parsing and traversing is done for every single web and kernel test. Doing this makes #2414951: Validate configuration schema before importing configuration possible.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2414953.1.patch | 2.86 KB | alexpott |
Comments
Comment #1
alexpottComment #2
Gábor HojtsyI looked at #2298687: Sequence and Mapping implement interfaces incorrectly, make them honest about what they support which is @tstoeckler/@reyero's ongoing refactoring of these classes. It moves those methods of Element to ArrayElement (and does away with Element entirely), because only arrays spawn new elements. I think this change will be possible to integrate in that patch and does not go against those efforts in any way. Also not sure this can be made better by moving towards that vision here because that would expose more of the refactoring here instead of the current goal of injecting the typed data manager.
So overall looks good to me as-is.
Comment #3
tstoecklerYup, great idea!
Comment #4
Jose Reyero CreditAttribution: Jose Reyero commentedThis makes a lot of sense.
The problem is it is one of the "features" inherited from TypedData and I think the place to fix all these dependencies is here, in the base TypedData class, several methods: getPluginDefinition(), getConstraints(), validate(), and still more in derived classes.
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21TypedData...
* This kind of 'hardcoded' typed data manager / typed data manager' is one of the reasons why we cannot really reuse too much from typed data classes.
Comment #5
catchCommitted/pushed to 8.0.x, thanks!