You are here

public function AddressItem::getFieldOverrides in Address 8

Gets the field overrides for the current field.

Return value

array FieldOverride constants keyed by AddressField constants.

3 calls to AddressItem::getFieldOverrides()
AddressItem::fieldSettingsForm in src/Plugin/Field/FieldType/AddressItem.php
Returns a form for the field-level settings.
AddressItem::getConstraints in src/Plugin/Field/FieldType/AddressItem.php
Gets a list of validation constraints.
AddressItem::getProperties in src/Plugin/Field/FieldType/AddressItem.php
Gets an array of property objects.

File

src/Plugin/Field/FieldType/AddressItem.php, line 249

Class

AddressItem
Plugin implementation of the 'address' field type.

Namespace

Drupal\address\Plugin\Field\FieldType

Code

public function getFieldOverrides() {
  $field_overrides = [];
  if ($fields = $this
    ->getSetting('fields')) {
    $unused_fields = array_diff(AddressField::getAll(), $fields);
    foreach ($unused_fields as $field) {
      $field_overrides[$field] = FieldOverride::HIDDEN;
    }
  }
  elseif ($overrides = $this
    ->getSetting('field_overrides')) {
    foreach ($overrides as $field => $data) {
      $field_overrides[$field] = $data['override'];
    }
  }
  return $field_overrides;
}