Created
May 8, 2013 22:08
-
-
Save betweenbrain/5544043 to your computer and use it in GitHub Desktop.
User configurable Joomla! 1.5 module select element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class JElementFoo extends JElement { | |
| var $_name = 'foo'; | |
| function fetchElement($name, $value, &$node, $control_name) { | |
| $cid = JRequest::getVar('cid'); | |
| $db = JFactory::getDBO(); | |
| $options = array(); | |
| $query = ' SELECT params' . | |
| ' FROM #__modules' . | |
| ' WHERE id = ' . $cid[0] . ''; | |
| $db->setQuery($query); | |
| $params = $db->loadResult(); | |
| preg_match('/configuration=([^\n]*)/', $params, $matches); | |
| $ids = explode(';', rtrim($matches[1], ';')); | |
| foreach ($ids as $id) { | |
| $pair = explode('|', $id); | |
| $options[] = JHtml::_('select.option', $pair[0], $pair[1]); | |
| } | |
| return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', '', 'value', 'text', $value, $control_name . $name); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uses a syntax of:
For each element.