public function ParagraphsItemEntity::__construct in Paragraphs 7
Constructs the entity object.
Overrides Entity::__construct
File
- ./
ParagraphsItemEntity.inc, line 103
Class
- ParagraphsItemEntity
- Entity implementation for the paragraphs entity.
Code
public function __construct(array $values = array(), $entityType = NULL) {
parent::__construct($values, 'paragraphs_item');
if (isset($this->field_name)) {
// Ok, we have the field name property, we can proceed and
// check the field's type.
$field_info = $this
->fieldInfo();
// Check if we have field info, if not, our field is deleted.
if (!$field_info) {
return FALSE;
}
// We only allow paragraphs type field for this entity.
if ($field_info['type'] != 'paragraphs') {
throw new Exception("Invalid field name given: {$this->field_name} is not a paragraphs field.");
}
}
}