public function getAddOnItem($pk = null) { $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id'); $storeId = __METHOD__ . '::' . $pk; if (!isset($this->_cache[$storeId])) { $false = false; // Get a row instance. $table = $this->getTable(); // Attempt to load the row. $return = $table->load($pk); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return $false; } // Convert to the JObject before adding other data. $properties = $table->getProperties(1); $this->_cache[$storeId] = JArrayHelper::toObject($properties, 'JObject'); // Convert the params field to an array. $registry = new Registry(); $registry->loadString($table->params); $this->_cache[$storeId]->params = $registry->toArray(); $dispatcher = JEventDispatcher::getInstance(); $plugin = TZ_Portfolio_PlusPluginHelper::getInstance($table->folder, $table->element, false, $dispatcher); if (method_exists($plugin, 'onAddOnDisplayManager')) { $this->_cache[$storeId]->manager = $plugin->onAddOnDisplayManager(); } } return $this->_cache[$storeId]; }
public function getItems() { if ($items = parent::getItems()) { $language = JFactory::getLanguage(); foreach ($items as &$item) { if (strlen($item->manifest_cache)) { $data = json_decode($item->manifest_cache); if ($data) { foreach ($data as $key => $value) { if ($key == 'type') { // Ignore the type field continue; } $item->{$key} = $value; } } } $plugin = TZ_Portfolio_PlusPluginHelper::getInstance($item->folder, $item->element); $item->data_manager = false; if (method_exists($plugin, 'getDataManager')) { $item->data_manager = $plugin->getDataManager(); } $langPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . $item->folder . DIRECTORY_SEPARATOR . $item->element; $langKey = 'plg_' . $item->folder . '_' . $item->element; if ($loaded = $language->load($langKey, $langPath)) { $langKey = strtoupper($langKey); if ($language->hasKey($langKey)) { $item->name = JText::_($langKey); } } $item->author_info = @$item->authorEmail . '<br />' . @$item->authorUrl; } return $items; } return false; }