You are here

protected function WebformTranslationConfigManager::getWebformElementProperties in Webform 6.x

Get flattened webform element properties from the webform_ui.module.

Parameters

string $type: The webform element type.

Return value

array The webform element type's properties from as a flattened associative array key by property names.

2 calls to WebformTranslationConfigManager::getWebformElementProperties()
WebformTranslationConfigManager::buildConfigWebformFormElements in src/WebformTranslationConfigManager.php
Build config webform form elements.
WebformTranslationConfigManager::getWebformElementProperty in src/WebformTranslationConfigManager.php
Get flattened webform element properties from the webform_ui.module.

File

src/WebformTranslationConfigManager.php, line 994

Class

WebformTranslationConfigManager
Defines a class to translate webform config.

Namespace

Drupal\webform

Code

protected function getWebformElementProperties($type) {
  if (isset($this->elementProperties[$type])) {
    return $this->elementProperties[$type];
  }
  $this->elementProperties[$type] = [];
  if ($this->moduleHandler
    ->moduleExists('webform_ui')) {
    if (!isset($this->webform)) {
      $this->webform = Webform::create();
    }
    try {
      $form = $this->formBuilder
        ->getForm('\\Drupal\\webform_ui\\Form\\WebformUiElementAddForm', $this->webform, NULL, NULL, $type);
      $this->elementProperties[$type] = $this
        ->getElementsFlattened($form['properties']);
    } catch (\Exception $exception) {

      // If the element type does not exist, do nothing.
    }
  }
  return $this->elementProperties[$type];
}