protected function setFormFields(&$form, $row) { $form->state = K2HelperHTML::state('state', $row->state, false, true, 'radio', true); $form->language = K2HelperHTML::language('language', $row->language); $form->access = JHtml::_('access.level', 'access', $row->access, '', false); $form->parent = K2HelperHTML::categories('parent_id', $row->parent_id, 'K2_NONE', $row->id); $form->inheritance = K2HelperHTML::categories('inheritance', $row->inheritance, 'K2_NONE', $row->id, '', false, 'id', true); $form->template = K2HelperHTML::template('template', $row->template); require_once JPATH_ADMINISTRATOR . '/components/com_k2/classes/editor.php'; $config = JFactory::getConfig(); $editor = K2Editor::getInstance($config->get('editor')); $form->description = $editor->display('description', $row->description, '100%', '300', '40', '5'); require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/extrafields.php'; $form->extraFields = K2HelperExtraFields::getCategoryExtraFieldsGroups($row->extra_fields); // Associations $associations = new stdClass(); $associations->enabled = JLanguageAssociations::isEnabled(); $associations->languages = array(); if ($associations->enabled) { $languages = JLanguageHelper::getLanguages('lang_code'); foreach ($languages as $tag => $language) { if (empty($row->language) || $tag != $row->language) { $lang = new stdClass(); $lang->title = $language->title; $lang->code = $language->lang_code; $lang->associated = new stdClass(); $lang->associated->title = ''; $lang->associated->id = ''; if (isset($row->associations) && is_array($row->associations) && isset($row->associations[$language->lang_code])) { $associated = $row->associations[$language->lang_code]; $lang->associated->title = $associated->title; $lang->associated->id = (int) $associated->id; } $associations->languages[] = $lang; } } } $form->associations = $associations; }