When creating a custom form field, is possible extend from another filelds, ex.: JFormFieldList
, JFormFieldText
. And when extend of this filelds, is usual to override the getInput()
or getOptions()
methods.
Now, I'm extending JFormFieldList
, and I want to keep the original getInput()
but adding a custom attribute to each option of select.
I think that this to work, the ideal would be to add some property to the option, and on the HTML renderer options()
function read this attr and add to the generated html
Below, how I want to override getOptions()
protected function getOptions(){
$options = parent::getOptions();
foreach ($options as $option) {
$option->attr="myattr='valueofmyattr'";
}
return $options;
}
Labels |
Added:
?
|
Status | Information Required | ⇒ | New |
Category | ⇒ | com_fields |
Title |
|
||||||
Status | New | ⇒ | Information Required |
Status | New | ⇒ | Information Required |
Yes something like that can work. But I think it is better to ask in the forum.
@angelovianajr as @laoneo suggested please ask help on the forums. (this repository concerns in first Place Joomla coding. For this Reason closing this Issue, thanks).
@laoneo thanks for Info.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-11-22 07:46:28 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_Date | 2017-11-22 07:46:28 | ⇒ | 2017-11-22 07:46:29 |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/18787
@laoneo any Clue?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18787.