I’m switching back and forth between projects in Joomla 3.X and Joomla 2.5… to get the field label text (not the HTML tags, just the text) from a JFormField object is simple enough in Joomla 3.X, since the class has a getAttribute() method, so:
$field = $form->getField('myfield'); $label = $field->getAttribute('label');
I could be mistaken, but didn’t see the same functionality in Joomla 2.5. The closest I’ve come up with is to get the full label, then strip out the HTML tags, like:
$field = $form->getField('myfield'); $label = strip_tags($field->__get('label'));
…which is ugly, but seems to work in the cases I’ve tested. Anyone know of a better way to access the element attributes directly in Joomla 2.5?