You are here

protected function SkinEditForm::elementOptions in Skinr 8.2

Return an array of element options for a module.

If no field type is provided, returns a nested array of all element options, keyed by module.

Parameters

string $theme_name:

string $element_type:

Return value

array

2 calls to SkinEditForm::elementOptions()
SkinEditForm::form in skinr_ui/src/Form/SkinEditForm.php
Gets the actual form array to be built.
SkinEditForm::updateElement in skinr_ui/src/Form/SkinEditForm.php
Handles switching the available elements based on the selected theme and element type.

File

skinr_ui/src/Form/SkinEditForm.php, line 330
Contains Drupal\skinr_ui\Form\SkinEditForm.

Class

SkinEditForm

Namespace

Drupal\skinr_ui\Form

Code

protected function elementOptions($theme_name = NULL, $element_type = NULL) {
  $options =& drupal_static(__FUNCTION__);
  if (!isset($options)) {
    $options = skinr_invoke_all('skinr_ui_element_options', $theme_name);
  }
  if ($element_type && isset($options[$element_type])) {
    if (!empty($theme_name)) {
      $theme = \Drupal::service('theme_handler')
        ->getTheme($theme_name);
      $theme_label = $theme->info['name'];
      if (isset($options[$element_type][$theme_label])) {
        return $options[$element_type][$theme_label];
      }
    }
    return $options[$element_type];
  }
  return array();
}