/** * @since 1.1.0 **/ public function getExtensions($withXML = false) { if (!property_exists($this->_data, self::PLUGIN_FOLDER)) { $data = $this->_getData(self::PLUGIN_FOLDER); $elements = $data->elements; $default = new JObject(); $default->name = self::EXTENSION_DEFAULT; $default->type = 'com_fieldsandfilters'; $default->option = self::EXTENSION_DEFAULT; $default->content_type_alias = 'com_fieldsandfilters.' . $default->option; $data->elements->set($default->option, $default); JPluginHelper::importPlugin(self::PLUGIN_FOLDER); // Trigger the onFieldsandfiltersPrepareFormField event. JFactory::getApplication()->triggerEvent('onFieldsandfiltersPrepareExtensions', array($data->elements)); $typesAlias = KextensionsArray::getColumn($data->elements, 'content_type_alias'); $query = $this->_getQuery($typesAlias); $types = (array) $this->_db->setQuery($query)->loadObjectList('type_alias'); $data->set('xml', (bool) $withXML); foreach ($data->elements as &$element) { $element->content_type_id = (int) array_key_exists($element->content_type_alias, $types) ? $types[$element->content_type_alias]->type_id : 0; /* @deprecated 1.2.0 */ // $element->extension_type_id = $element->content_type_id; /* @end deprecated 1.2.0 */ if ($data->xml) { FieldsandfiltersXml::getPluginOptionsForms($element); } } } elseif ($withXML && !$this->_getData(self::PLUGIN_FOLDER)->xml) { $data = $this->_getData(self::PLUGIN_FOLDER); $data->set('xml', (bool) $withXML); foreach ($data->elements as &$element) { FieldsandfiltersXml::getPluginOptionsForms($element); } } return $this->_getData(self::PLUGIN_FOLDER)->elements; }
/** * * @since 1.0.0 */ protected function _beforeSearchElements($data, $key = 'id') { $elements = array(); foreach ($this->_data as $_data) { if ($_data == $data) { continue; } $elements = array_merge($elements, KextensionsArray::getColumn($_data->get('elements', new stdClass()), 'item_id', 'id')); } return $elements; }
/** * * @since 1.1.0 */ protected function _beforeSearchElements($data, $key = 'id') { if ($this->method == 'getElementsByItemID') { // Get elements id from elements where is items id $this->_elementsItemsID = KextensionsArray::getColumn($data->get('elements', new stdClass()), 'item_id', 'id'); $key = 'item_id'; } return parent::_beforeSearchElements($data, $key); }
/** * @since 1.0.0 **/ protected function _getBufferColumn() { $arguments = func_get_args(); $hash = md5($this->method . serialize($arguments)); if (!isset($this->_columns[$hash])) { $column = $arguments[0]; unset($arguments[0]); if ($this->_isMethod($this->method) && is_string($column)) { $buffer = call_user_func_array(array($this, $this->method), $arguments); $this->_columns[$hash] = KextensionsArray::getColumn($buffer, $column); unset($buffer); } else { $this->_columns[$hash] = array(); } } else { // Reset arguments $this->_resetArgs(); } return $this->_columns[$hash]; }