reindex($row->id); } } /** * Method to update the link information for items that have been changed * from outside the edit screen. This is fired when the item is published, * unpublished, archived, or unarchived from the list view. * * @param string $context The context for the highlight passed to the plugin. * @param array $pks An array of primary key ids of the highlight that has changed state. * @param integer $value The value of the state that the highlight has been changed to. * * @return void * * @since 1.0.0 */ public function onFinderChangeState($context, $pks, $value) { // We only want to handle highlight here. if ($context === 'com_highlights.highlight') { $this->itemStateChange($pks, $value); } } /** * Method to get a SQL query to load the published and access states for * an highlight and category. * * @return QueryInterface A database object. * * @since 1.0.0 */ protected function getStateQuery() { $query = $this->db->getQuery(true); // Item ID $query->select('a.id'); $query->select('1 AS access'); $query->from($this->table . ' AS a'); return $query; } /** * Method to index an item. The item must be a Result object. * * @param Result $item The item to index as a Result object. * * @return void * * @since 1.0.0 * @throws Exception on database error. */ protected function index(Result $item) { $item->setLanguage(); // Check if the extension is enabled. if (ComponentHelper::isEnabled($this->extension) === false) { return; } $item->url = $this->getUrl($item->id, $this->extension, $this->layout); $item->route = $item->url; $item->context = 'com_highlights.highlight'; $this->indexer->index($item); } /** * Method to get the SQL query used to retrieve the list of highlight items. * * @param mixed $query A DatabaseQuery object or null. * * @return DatabaseQuery A database object. * * @since 1.0.0 */ protected function getListQuery($query = null) { $db = $this->db; // Check if we can use the supplied SQL query. $query = $query instanceof DatabaseQuery ? $query : $db->getQuery(true) ->select('a.id, a.titolo AS title, a.titolo AS summary, a.state AS state, 1 AS access'); $query->from($this->table . ' as a'); return $query; } }