You are here

public function RdfMapping::setBundleMapping in Drupal 8

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

Sets the mapping config for the bundle-level data.

This only sets bundle-level mappings, such as the RDF type. Mappings for a bundle's fields should be handled with setFieldMapping.

Example usage: -Map the 'article' bundle to 'sioc:Post'.

rdf_get_mapping('node', 'article')
  ->setBundleMapping(array(
  'types' => array(
    'sioc:Post',
  ),
))
  ->save();

Parameters

array $mapping: The bundle mapping.

Return value

\Drupal\rdf\Entity\RdfMapping The RdfMapping object.

Overrides RdfMappingInterface::setBundleMapping

File

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

Class

RdfMapping
Config entity for working with RDF mappings.

Namespace

Drupal\rdf\Entity

Code

public function setBundleMapping(array $mapping) {
  if (isset($mapping['types'])) {
    $this->types = $mapping['types'];
  }
  return $this;
}