Reputation: 1
I'm migrating a Joomla 1.5 website to Joomla 3.8 for one of our customers. It has an external component that's not supported anymore that I'm trying to get to work for Joomla 3.8. Most of it works now, except for the edit view in the administrator.
There are 3 fields for now that don't seem to work right.
First there are fields named title, and alias that kind of work but don't prefill anymore with the values they already have. They are formatted like this in the xml config file:
<fieldset addfieldpath="/administrator/components/com_faqftw/models/fields"
name="essential" >
<fields name="filter">
<field name="id" type="hidden" label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC" size="10" default="0" readonly="true" class="readonly" />
<field name="title" type="text" label="COM_FAQFTW_FIELD_FAQ_NAME_LABEL"
description="COM_FAQFTW_FIELD_FAQ_NAME_DESC" class="inputbox" size="30" required="true" />
<field name="alias" type="text" label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC" size="30" required="false" />
Secondly there's a field named "ordering" which, if enabled in the xml, throws an sql error. This field is formatted as a custom field and has it's own class extending JFormField, but disabling that doesn't make a difference. That one is formatted like this:
<field name="ordering" type="Ordering" class="inputbox" label="JFIELD_ORDERING_LABEL"
description="JFIELD_ORDERING_DESC" />
The SQL error thrown:
1064 You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'WHERE `catid` = 0 ORDER BY ordering'
at line 3 httpdocs/libraries/joomla/database/driver/mysqli.php:650
So, the hunch I have is that some naming convention got introduced and these field names are not allowed anymore. If that's the case, can somebody give me some pointers on what's the most future-proof way to rename these files or point me to some documentation on these fields that's more helpful than the things that are on the docs.joomla.org site.
If you think I'm wrong, I'll gladly hear that too with some pointer in the right direction hopefully :)
The custom field php file: defined('JPATH_BASE') or die;
/**
* Supports an HTML select list of categories
*
* @package Joomla.Administrator
* @subpackage com_weblinks
* @since 1.6
*/
class JFormFieldOrdering extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Ordering';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Initialize variables.
$html = array();
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Get some field values from the form.
$faqId = (int) $this->form->getValue('id');
// Build the query for the ordering list.
$query = 'SELECT ordering AS value, title AS text' .
' FROM #__faqftw_faq' .
' ORDER BY ordering';
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true') {
$html[] = JHtml::_('list.ordering', '', $query, trim($attr), $this->value, $faqId ? 0 : 1);
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
}
// Create a regular list.
else {
$html[] = JHtml::_('list.ordering', $this->name, $query, trim($attr), $this->value, $faqId ? 0 : 1);
}
return implode($html);
}
}
Upvotes: 0
Views: 293