Back to FeedEntry class

Method addLink

public \Joomla\CMS\Feed\FeedEntry
(\Joomla\CMS\Feed\FeedLink $link)
Method to add a link to the feed entry object.
Parameters
  • \Joomla\CMS\Feed\FeedLink $link The link object to add.
Returns
  • \Joomla\CMS\Feed\FeedEntry
Since
  • 3.1.4
Class: FeedEntry
Project: Joomla

Method addLink - Source code

/**
 * Method to add a link to the feed entry object.
 *
 * @param   FeedLink  $link  The link object to add.
 *
 * @return  FeedEntry
 *
 * @since   3.1.4
 */
public function addLink(FeedLink $link)
{
    // If the new link already exists then there is nothing to do, so just return.
    foreach ($this->properties['links'] as $l) {
        if ($l == $link) {
            return $this;
        }
    }
    // Add the new link.
    $this->properties['links'][] = $link;
    return $this;
}