You are here

function paragraphs_item_set_host_entity in Paragraphs 7

Entity property info setter callback for the host entity property.

As the property is of type entity, the value will be passed as a wrapped entity.

1 string reference to 'paragraphs_item_set_host_entity'
ParagraphsItemMetadataController::entityPropertyInfo in ./ParagraphsItemMetadataController.inc
Generate basic metadata for a paragraphs item.

File

./paragraphs.module, line 1040
Paragraphs hooks and common functions.

Code

function paragraphs_item_set_host_entity($item, $property_name, $wrapper) {
  if (empty($item->is_new)) {
    throw new EntityMetadataWrapperException('The host entity may be set only during creation of a paragraphs item.');
  }
  $item
    ->setHostEntity($wrapper
    ->type(), $wrapper
    ->value());
}