public function ModuleBuilderComponentFormBase::componentPropertiesForm in Module Builder 7.2
Add form elements for the specified component properties.
Parameters
$form: The form array.
FormStateInterface $form_state: The form state object.
$component_properties_to_use: An array of property names from the component.
Return value
The form array.
1 call to ModuleBuilderComponentFormBase::componentPropertiesForm()
File
- includes/
module_builder.form.inc, line 123
Class
- ModuleBuilderComponentFormBase
- Backport of ComponentFormBase from 8.x-3.x version.
Code
public function componentPropertiesForm($form, FormStateInterface $form_state) {
$component_data_info = $this->codeBuilderTaskHandlerGenerate
->getRootComponentDataInfo();
// dsm($component_data_info);
$component_data = [];
/*
// Sanity check the list of properties to use.
// Iterate over our list of properties, so we are in control of the order.
foreach ($component_properties_to_use as $property_name) {
if (!isset($component_data_info[$property_name])) {
drupal_set_message(t("The property '@name' is not defined in Drupal Code Builder. You should ensure you are using an up-to-date version.", [
'@name' => $property_name,
]), 'error');
continue;
}
}
$component_properties_to_use = array_fill_keys($component_properties_to_use, TRUE);
// Mark the ones we don't show here. We keep the full data array as the
// prepare property step should always work on the full list of properties.
// Note that this means our setting is NOT in control of the order!!!
foreach ($component_data_info as $property_name => &$property_info) {
if (!isset($component_properties_to_use[$property_name])) {
$property_info['hidden'] = TRUE;
}
}
*/
static::$componentDataInfo = $component_data_info;
$form['data'] = $this
->getCompomentElement($form_state, [], [], [
'data',
]);
// Set #tree on the data element.
$form['data']['#tree'] = TRUE;
return $form;
}