Back to FeedEntry class

Method removeContributor

public \Joomla\CMS\Feed\FeedEntry
removeContributor
(\Joomla\CMS\Feed\FeedPerson $contributor)
Method to remove a contributor from the feed entry object.
Parameters
  • \Joomla\CMS\Feed\FeedPerson $contributor The person object to remove.
Returns
  • \Joomla\CMS\Feed\FeedEntry
Since
  • 3.1.4
Class: FeedEntry
Project: Joomla

Method removeContributor - Source code

/**
 * Method to remove a contributor from the feed entry object.
 *
 * @param   FeedPerson  $contributor  The person object to remove.
 *
 * @return  FeedEntry
 *
 * @since   3.1.4
 */
public function removeContributor(FeedPerson $contributor)
{
    // If the contributor exists remove it.
    foreach ($this->properties['contributors'] as $k => $c) {
        if ($c == $contributor) {
            unset($this->properties['contributors'][$k]);
            $this->properties['contributors'] = array_values($this->properties['contributors']);
            return $this;
        }
    }
    return $this;
}