You are here

protected function PatternWrapperEntityReferenceFormatter::getDefaultValue in UI Patterns Field Formatters 8

Helper function: get default value.

Parameters

array $configuration: Configuration.

string $field_name: Field name.

string $value: Value name.

Return value

string Field property value.

Overrides PatternDisplayFormTrait::getDefaultValue

File

src/Plugin/Field/FieldFormatter/PatternWrapperEntityReferenceFormatter.php, line 235

Class

PatternWrapperEntityReferenceFormatter
Plugin implementation of 'pattern_wrapper_entity_reference_formatter'.

Namespace

Drupal\ui_patterns_field_formatters\Plugin\Field\FieldFormatter

Code

protected function getDefaultValue(array $configuration, $field_name, $value) {

  // Some modifications to make 'destination' default value working.
  $pattern = $configuration['pattern'];
  if (isset($configuration['pattern_mapping'][$pattern]['settings'][$field_name][$value])) {
    return $configuration['pattern_mapping'][$pattern]['settings'][$field_name][$value];
  }
  return NULL;
}