You are here

protected function PatternFormatter::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/PatternFormatter.php, line 273

Class

PatternFormatter
Plugin implementation of the 'pattern' 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;
}