You are here

public function FacebookPublicationEntity::__construct in Facebook Autopost 7

Entity constructor.

Overrides Entity::__construct

File

fb_autopost_entity/fb_autopost_entity.module, line 441
Module implementation file

Class

FacebookPublicationEntity
The class used for Facebook publication entities.

Code

public function __construct($values = array()) {
  if (isset($values['user'])) {
    $this
      ->setUser($values['user']);
    unset($values['user']);
  }
  if (isset($values['type']) && is_object($values['type'])) {
    $values['type'] = $values['type']->type;
  }
  if (!isset($values['label']) && isset($values['type']) && ($type = facebook_publication_get_types($values['type']))) {

    // Initialize the label with the type label, so newly created publications
    // have that as interim label.
    $values['label'] = $type->label;
  }
  parent::__construct($values, 'facebook_publication');
}