You are here

public static function UiPatternsSettings::getPatternDefinitionSettings in UI Patterns Settings 8

Same name and namespace in other branches
  1. 8.2 src/UiPatternsSettings.php \Drupal\ui_patterns_settings\UiPatternsSettings::getPatternDefinitionSettings()

Get setting definitions for a pattern definition.

Parameters

\Drupal\ui_patterns\Definition\PatternDefinition $definition: The definition.

Return value

\Drupal\ui_patterns_settings\Definition\PatternDefinitionSetting[] Setting pattern definitons.

5 calls to UiPatternsSettings::getPatternDefinitionSettings()
PatternSettings::hasSettings in src/Element/PatternSettings.php
Whereas pattern has settings or not.
SettingsFormBuilder::displayForm in src/Form/SettingsFormBuilder.php
Build pattern settings for display form.
SettingsFormBuilder::layoutForm in src/Form/SettingsFormBuilder.php
Build pattern settings fieldset.
UiPatternsSettings::preprocess in src/UiPatternsSettings.php
Preprocess all settings variables.
ui_patterns_settings_theme_registry_alter in ./ui_patterns_settings.module
Implements hook_theme_registry_alter().

File

src/UiPatternsSettings.php, line 88

Class

UiPatternsSettings
UI Patterns setting factory class.

Namespace

Drupal\ui_patterns_settings

Code

public static function getPatternDefinitionSettings(PatternDefinition $definition) {
  $additional = $definition
    ->getAdditional();
  $settings_ary = isset($additional['settings']) ? $additional['settings'] : [];
  $settings = [];
  if (!empty($settings_ary)) {
    foreach ($settings_ary as $key => $setting_ary) {
      $settings[$key] = new PatternDefinitionSetting($key, $setting_ary);
    }
  }
  return $settings;
}