You are here

public function RdfMapping::getPreparedFieldMapping in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/src/Entity/RdfMapping.php \Drupal\rdf\Entity\RdfMapping::getPreparedFieldMapping()
  2. 10 core/modules/rdf/src/Entity/RdfMapping.php \Drupal\rdf\Entity\RdfMapping::getPreparedFieldMapping()

Gets the prepared mapping for a field.

The prepared field mapping should be used when outputting data in RDF serializations such as RDFa. In the prepared mapping, the mapping configuration's CURIE arrays are processed into CURIE strings suitable for output.

Parameters

string $field_name: The name of the field.

Return value

array The prepared field mapping, or an empty array if there is no mapping.

Overrides RdfMappingInterface::getPreparedFieldMapping

File

core/modules/rdf/src/Entity/RdfMapping.php, line 103

Class

RdfMapping
Config entity for working with RDF mappings.

Namespace

Drupal\rdf\Entity

Code

public function getPreparedFieldMapping($field_name) {
  $field_mapping = [
    'properties' => NULL,
    'datatype' => NULL,
    'datatype_callback' => NULL,
    'mapping_type' => NULL,
  ];
  if (isset($this->fieldMappings[$field_name])) {
    $field_mapping = array_merge($field_mapping, $this->fieldMappings[$field_name]);
  }
  return empty($field_mapping['properties']) ? [] : $field_mapping;
}