Jump to content

Community

Developer Documentation

core/RssImport

What it does

RssImport extensions allow your applications to create content from imported RSS Feeds. Administrators can set up RSS imports within the admin control panel from a central location and choose where the RSS items should be created. By adding an extension you can include your application content types in this list.

How to use

You will need the following 5 methods. For example usage please see /applications/forums/extensions/core/RssImport;

    /**
     * Return available options for a Form\Select
     *
     * @return array
     */
    public function availableOptions()
    {
    }

availableOptions allows you to specify the content type to import to.

    /**
     * Node selector options
     *
     * @param     \IPS\core\Rss\Import|null    $rss    Existing RSS object if editing|NULL if not
     * @return array
     */
    public function nodeSelectorOptions( $rss )
    {
    }

nodeSelectorOptions allows you to choose which container type to import items to as well as any conditions for the nodes available via the permissionCheck callback.

    /**
     * @param \IPS\core\Rss\Import     $rss         RSS object
     * @param array                 $article     RSS feed article importing
     * @param \IPS\Node\Model         $container  Container object
     * @param    string                $content    Post content with read more link if set
     * @return \IPS\Content
     */
    public function create( \IPS\core\Rss\Import $rss, $article, \IPS\Node\Model $container, $content )
    {  
    }

The create method accepts info on the RSS import object as well as the article from the feed being imported, the container selected by the administrator for the import and the article content. This method should be used to create the content item in your application from the RSS article.

	/**
	 * Addition Form elements
	 *
	 * @param	\IPS\Helpers\Form			$form	The form
	 * @param	\IPS\core\Rss\Import|null		$rss	Existing RSS object if editing|NULL if not
	 * @return	void
	 */
	public function form( &$form, $rss=NULL )
	{
	}

Aside from the container, you can also specify additional form options here. For example you could provide a form field for tags so the admin can specify which tags should be added to the application content item.

    /**
     * Process additional fields unique to this extension
     *
     * @param    array                $values    Values from form
     * @param    \IPS\core\Rss\Import        $rss    Existing RSS object
     * @return    array
     */
    public function saveForm( &$values, $rss )
    {
    }

The saveForm method can be used to perform additional processing on the values submitted in the form() method above.


  Report Document


×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy