You are here

public function PatternDisplayFormTrait::getMappingDestination in UI Patterns 8

Helper function: return mapping destination given plugin id and field name.

Parameters

string $plugin: Current plugin ID.

string $source: Source field name.

array $settings: Setting array.

Return value

string|null Destination field or NULL if none found.

1 call to PatternDisplayFormTrait::getMappingDestination()
PatternDisplayFormTrait::hasMappingDestination in src/Form/PatternDisplayFormTrait.php
Helper function: check if given source field has mapping destination.

File

src/Form/PatternDisplayFormTrait.php, line 200

Class

PatternDisplayFormTrait
Trait PatternDisplayFormTrait.

Namespace

Drupal\ui_patterns\Form

Code

public function getMappingDestination($plugin, $source, array $settings) {
  $mapping_id = $plugin . PatternSourceBase::DERIVATIVE_SEPARATOR . $source;
  if (isset($settings['pattern_mapping'][$mapping_id])) {
    return $settings['pattern_mapping'][$mapping_id]['destination'];
  }
  return NULL;
}