You are here

protected function ModuleMiscForm::getFormComponentProperties in Module Builder 8.3

Gets the names of properties this form should show.

Return value

string[] An array of property names.

Overrides ComponentSectionForm::getFormComponentProperties

File

src/Form/ModuleMiscForm.php, line 19

Class

ModuleMiscForm
Form for selecting other components to implement.

Namespace

Drupal\module_builder\Form

Code

protected function getFormComponentProperties(DataItem $data) {

  // Get the list of component properties used in all the other section forms.
  $component_entity_type_id = $this->entity
    ->getEntityTypeId();
  $component_sections_handler = $this->entityTypeManager
    ->getHandler($component_entity_type_id, 'component_sections');
  $used_component_properties = $component_sections_handler
    ->getUsedComponentProperties();

  // Argh, these are in the name form, but hardcoded!
  $used_component_properties[] = 'readable_name';
  $used_component_properties[] = 'root_name';

  // These are not that useful on D8, and at any rate would need to find
  // their way into the hooks form.
  // TODO: add a way to speficy properties we just skip.
  $used_component_properties[] = 'module_hook_presets';

  // Get the list of component properties that are not explicitly set in a
  // form: these are the ones we show here.
  $component_data_property_names = $data
    ->getPropertyNames();
  $component_properties_to_use = array_diff($component_data_property_names, $used_component_properties);
  return $component_properties_to_use;
}