protected function prepareRow($row) { // State and featured flags if (!$row->id) { $row->state = 1; $row->featured = 0; } // Tags $row->tags = $row->getTags(); $tagsValue = array(); foreach ($row->tags as $tag) { $tagsValue[] = $tag->name; } $row->tagsValue = implode(',', $tagsValue); $user = JFactory::getUser(); $canCreateTag = $user->authorise('k2.tags.create', 'com_k2') || $user->authorise('k2.tags.manage', 'com_k2'); $row->canCreateTag = $canCreateTag ? '1' : ''; // Attachments $row->attachments = $row->getAttachments(); // Revisions $params = JComponentHelper::getParams('com_k2'); $row->revisionsEnabled = (bool) $params->get('revisions'); $row->revisions = array(); if ($row->canEdit && $row->revisionsEnabled) { $row->revisions = $row->getRevisions(); } // Media $row->allVideos = JPluginHelper::isEnabled('content', 'jw_allvideos'); $row->media = $row->getMedia(); // Galleries $row->sigPro = JPluginHelper::isEnabled('content', 'jw_sigpro'); $row->galleries = $row->getGalleries(); // Associations if (JLanguageAssociations::isEnabled()) { $row->associations = array(); if ($row->id) { require_once JPATH_SITE . '/components/com_k2/helpers/association.php'; $associations = K2HelperAssociation::getItemAssociations($row->id); foreach ($associations as $tag => $association) { $row->associations[$tag] = $association; } } } }
protected function prepareRow($row) { // State if (!$row->id) { $row->state = 1; } // Associations if (JLanguageAssociations::isEnabled()) { $row->associations = array(); if ($row->id) { require_once JPATH_SITE . '/components/com_k2/helpers/association.php'; $associations = K2HelperAssociation::getCategoryAssociations($row->id); foreach ($associations as $tag => $association) { $row->associations[$tag] = $association; } } } }