Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293850

Make TypedDataManager::createInstance() load data definition on its own

$
0
0

The TypedDataManager::createInstance() method requires, beside the typed data definition name, the definition itself which basically means that instead of one line of code we need to write two/three.
If there is no significant reason for doing it this way I propose that the createInstance() method fetches the definition on its own.

Currently:

$field_name = 'field_item:something';
$definition = \Drupal::typedDataManager()->createDataDefinition($field_name);
$field_instance = \Drupal::typedDataManager()->createInstance($field_name, array('data_definition' => $definition));

Proposed change:

$field_instance = \Drupal::typedDataManager()->createInstance('field_item:something');

Viewing all articles
Browse latest Browse all 293850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>