function PMPAPIDrupalPull::mapLabel in Public Media Platform API Integration 7
Maps a doc attribute to an entity's label.
Parameters
$entity object: A Drupal entity.
$doc object: A PMP doc.
$label string: The name of the label of the entity.
$pmp_label_field string: The doc attribute (e.g. - title) that is being mapped to the entity label.
1 call to PMPAPIDrupalPull::mapLabel()
- PMPAPIDrupalPull::mapFields in pmpapi_pull/
classes/ PMPAPIDrupalPull.php - Maps PMP doc attributes to entity fields.
File
- pmpapi_pull/
classes/ PMPAPIDrupalPull.php, line 291 - Contains PMPAPIDrupalPull.
Class
- PMPAPIDrupalPull
- Turns PMP hypermedia docs in Drupal entities.
Code
function mapLabel($entity, $doc, $label, $pmp_label_field) {
// Since node and file titles have a hard DB limit of 255, we truncate here,
// to prevent all sorts of issues.
$entity->{$label} = substr($doc->attributes->{$pmp_label_field}, 0, 255);
}