/** * Add an embeds relation * * @param string $url Embedded URL * @param string $label Label */ protected function addEmbedsRelation($url, $label = null) { if (strlen($url) && !array_key_exists($url, $this->embeds)) { $this->embeds[$url] = true; $this->object->addRelation($this->getRelationString($url, $label), Relation::EMBEDS); } }
/** * Set the payload * * @param string $payload Payload * @return Note Self reference */ public function setPayload($payload) { // Get the current title and abstract and determine if they should be adapted list($currentTitle, $currentAbstract) = $this->extractTitleAndAbstract($this->getPayload()); $adaptTitle = $currentTitle == $this->getTitle(); $adaptAbstract = $currentAbstract == $this->getAbstract(); // Set and process the payload parent::setPayload($payload); // Get the new title and abstract list($title, $abstract) = $this->extractTitleAndAbstract($this->getPayload()); // If the title should be adapted if ($adaptTitle) { $this->setTitle($title); } // If the abstract should be adapted if ($adaptAbstract) { $this->setAbstract($abstract); } return $this; }