Доброго времени.
В компоненте Joomla 3 (выполненном по аналогии с 'com_content'), не понятно где происходит разбор и сохранение поля articletext.
В базе соответственно нет такого поля там introtext и fulltext.
При нажатии кнопки сохранить сохраняются все данные кроме вышеуказанного поля.
В модели есть методы:
getItem($pk = null) - это для получения данных при редактировании. В нём как раз происходит слияние полей interotext и fulltext.
$item->articletext = trim($item->fulltext)!= '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;getForm($data = array(), $loadData = true) - судя по всему он то и собирает форму возвращает объект $form.
loadFormData() - Написано что это метод, чтобы получить данные, которые следует вводить в виде. Возвращает объект $data.
Вот его вывод:
JObject Object
(
[_errors:protected] => Array
(
)
[id] => 73
[asset_id] => 187
[title] => aasdasdasdasd
[alias] => aasdasdasdasd
[introtext] =>
[fulltext] =>
[state] => 1
[catid] => 79
[created] => 0000-00-00 00:00:00
[created_by] => 0
[created_by_alias] =>
[modified] => 0000-00-00 00:00:00
[modified_by] => 0
[checked_out] => 593
[checked_out_time] => 2013-12-05 06:28:26
[publish_up] => 2013-12-04 21:42:05
[publish_down] => 0000-00-00 00:00:00
[images] => Array
(
[image_intro] => images/joomla_black.gif
[float_intro] =>
[image_intro_alt] =>
[image_intro_caption] =>
[image_fulltext] =>
[float_fulltext] =>
[image_fulltext_alt] =>
[image_fulltext_caption] =>
)
[urls] => Array
(
[urla] =>
[urlatext] =>
[targeta] =>
[urlb] =>
[urlbtext] =>
[targetb] =>
[urlc] =>
[urlctext] =>
[targetc] =>
)
[attribs] => Array
(
)
[version] => 11
[ordering] => 3
[metakey] =>
[metadesc] =>
[access] => 1
[hits] => 0
[metadata] => Array
(
)
[featured] => 0
[language] => *
[xreference] =>
[articletext] =>
[tags] => JHelperTags Object
(
[tagsChanged:protected] =>
[replaceTags:protected] =>
[typeAlias] =>
[tags] =>
)
)
Как видно в поля introtext и fulltext ничего не попало
save($data) - Метод, чтобы сохранить данные формы. Return TRUE/FALSE в моём случае TRUE.
На всякий случай сам метод:
public function save($data)
{
$app = JFactory::getApplication();
if (isset($data['images']) && is_array($data['images']))
{
$registry = new JRegistry;
$registry->loadArray($data['images']);
$data['images'] = (string) $registry;
}
if (isset($data['urls']) && is_array($data['urls']))
{
foreach ($data['urls'] as $i => $url)
{
if ($url != false && ($i == 'urla' || $i == 'urlb' || $i = 'urlc'))
{
$data['urls'][$i] = JStringPunycode::urlToPunycode($url);
}
}
$registry = new JRegistry;
$registry->loadArray($data['urls']);
$data['urls'] = (string) $registry;
}
// Alter the title for save as copy
if ($app->input->get('task') == 'save2copy')
{
list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
$data['title'] = $title;
$data['alias'] = $alias;
$data['state'] = 0;
}
if (parent::save($data))
{
if (isset($data['featured']))
{
$this->featured($this->getState($this->getName(). '.id'), $data['featured']);
}
$assoc = isset($app->item_associations)? $app->item_associations : 0;
if ($assoc)
{
$id = (int) $this->getState($this->getName(). '.id');
$item = $this->getItem($id);
// Adding self to the association
$associations = $data['associations'];
foreach ($associations as $tag => $id)
{
if (empty($id))
{
unset($associations[$tag]);
}
}
// Detecting all item menus
$all_language = $item->language == '*';
if ($all_language && !empty($associations))
{
JError::raiseNotice(403, JText::_('COM_CONTENT_ERROR_ALL_LANGUAGE_ASSOCIATED'));
}
$associations[$item->language] = $item->id;
// Deleting old association for these items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete('#__associations')
->where('context=' . $db->quote('com_myshop.item'))
->where('id IN (' . implode(',', $associations). ')');
$db->setQuery($query);
$db->execute();
if ($error = $db->getErrorMsg())
{
$this->setError($error);
return false;
}
if (!$all_language && count($associations))
{
// Adding new association for these items
$key = md5(json_encode($associations));
$query->clear()
->insert('#__associations');
foreach ($associations as $id)
{
$query->values($id . ',' . $db->quote('com_myshop.item'). ',' . $db->quote($key));
}
$db->setQuery($query);
$db->execute();
if ($error = $db->getErrorMsg())
{
$this->setError($error);
return false;
}
}
}
return true;
}
return false;
}
Дамп $data говорит что в массиве $data есть поле articletext, но где оно разбирается и почему оно не попадает в базу.
Array
(
[id] => 74
[title] => ererere
[alias] =>
[articletext] =>
asd asd
---------
asd asd
[state] => 1
[catid] => 80
[created] =>
[created_by] => 0
[created_by_alias] =>
[publish_up] => 2013-12-04 21:06:29
[publish_down] =>
[version] =>
[metakey] =>
[metadesc] =>
[access] => 1
[language] => *
[featured] => 0
[attribs] => Array
(
[show_title] =>
[link_titles] =>
[show_tags] =>
[show_intro] =>
[info_block_position] =>
[show_category] =>
[link_category] =>
[show_parent_category] =>
[link_parent_category] =>
[show_author] =>
[link_author] =>
[show_create_date] =>
[show_modify_date] =>
[show_publish_date] =>
[show_item_navigation] =>
[show_icons] =>
[show_print_icon] =>
[show_email_icon] =>
[show_vote] =>
[show_hits] =>
[show_noauth] =>
[urls_position] =>
[alternative_readmore] =>
[article_layout] =>
[show_publishing_options] =>
[show_article_options] =>
[show_urls_images_backend] =>
[show_urls_images_frontend] =>
)
[xreference] =>
[images] => Array
(
[image_intro] =>
[float_intro] =>
[image_intro_alt] =>
[image_intro_caption] =>
[image_fulltext] =>
[float_fulltext] =>
[image_fulltext_alt] =>
[image_fulltext_caption] =>
)
[urls] => Array
(
[urla] =>
[urlatext] =>
[targeta] =>
[urlb] =>
[urlbtext] =>
[targetb] =>
[urlc] =>
[urlctext] =>
[targetc] =>
)
[metadata] => Array
(
[robots] =>
[author] =>
[rights] =>
[xreference] =>
)
[tags] =>
)
Подскажите пожалуйста где смотреть? Или объясните алгоритм сохранения материала. Самостоятельно не могу разобраться. Спасибо!