joomla/joomla-platform — pull request #1151 by mbabker (2012-04-14 12:30:05+00:00)
Title: Allow media field to be disabled fully

In either the form XML or in a model's getForm method (for those extending JModelForm), it is possible to set the disabled attribute on form fields. In trying to use this for some code I'm working on, I've found that in its current form, the media field cannot truly be disabled or read-only. In using `$form->setFieldAttribute('logo', 'disabled', 'true');` in my model's getForm method, the Select and Clear buttons are still active and usable. So, for this field to be truly disabled, I've added a check for the disabled element prior to rendering the two buttons.

Use Case:
I'm using the same model in the back end to load a form with one of two layouts: the regular edit layout, and a "details" layout which loads the form data in basically a read-only state and adds a little more data to be viewed by the user.