Favorites API

With favorites API you can generate a link or button, depending on the classes that you are using, that will allow users to favorite an item.


Left: Item can be favorited. Right: Item is favorited, can be unfavorited.

API example

jimport('oniscore.favorite'); //import favorites libraries

$favoritesHTML  = onisFavorite::favorite((int)$petition->id, 'petition', 'btn btn-xs btn-default', CCOMPONENT);

Generate the HTML code:

onisFavorite::favorite($itemid, $item, $class = NULL, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $class - css classes for the button;
  • $component - component name;

You can change HTML code here: