protected function ComponentFormBase::getComponentDataObject in Module Builder 8.3
Gets the data object for the entity in the form.
Return value
\MutableTypedData\Data\DataItem The data item object loaded with entity data.
2 calls to ComponentFormBase::getComponentDataObject()
- ComponentGenerateForm::form in src/
Form/ ComponentGenerateForm.php - Gets the actual form array to be built.
- ComponentSectionForm::componentPropertiesForm in src/
Form/ ComponentSectionForm.php - Add form elements for the specified component properties.
File
- src/
Form/ ComponentFormBase.php, line 104
Class
- ComponentFormBase
- Base class for Module Builder component forms.
Namespace
Drupal\module_builder\FormCode
protected function getComponentDataObject() : DataItem {
$component_data = $this->codeBuilderTaskHandlerGenerate
->getRootComponentData();
$entity_component_data = $this->entity
->get('data');
// Add in the component root name and readable name, because these are saved
// as top-level properties in the entity config, and so aren't in the
// component data.
$entity_component_data['root_name'] = $this->entity
->id();
$entity_component_data['readable_name'] = $this->entity
->label();
if ($entity_component_data) {
// Use import() to allow for changes in DCB's data structure and an older
// data structure in the saved module entiy.
$component_data
->import($entity_component_data);
}
return $component_data;
}