You are here

public function ConfigManager::getMappingByType in UI Patterns Settings 8.2

Gets all mapping by entity type.

Return value

string[] List of mappings.

File

src/ConfigManager.php, line 92

Class

ConfigManager
UI Patterns setting factory class.

Namespace

Drupal\ui_patterns_settings

Code

public function getMappingByType($type) {
  if (isset($this->typeMap[$type])) {
    return $this->typeMap[$type];
  }
  $map = is_array($this->config
    ->get('mapping')) ? $this->config
    ->get('mapping') : [];
  foreach ($map as $field_id => $pattern_id) {
    [
      $field_type,
      $field_name,
    ] = explode('--', $field_id);
    $this->typeMap[$field_type][$field_name] = $pattern_id;
  }
  if (!isset($this->typeMap[$type])) {
    $this->typeMap[$type] = [];
  }
  return $this->typeMap[$type];
}