| @@ 36-69 (lines=34) @@ | ||
| 33 | // If the custom method is not from a module, than it's from the core |
|
| 34 | $control = $object->getControl($key); |
|
| 35 | ||
| 36 | if (isset($control['options'])) { |
|
| 37 | $this->addOptionArray($control['options']); |
|
| 38 | } else { |
|
| 39 | // let's find if the method we need to call comes from an already defined object |
|
| 40 | if (isset($control['object'])) { |
|
| 41 | if (method_exists($control['object'], $control['method'])) { |
|
| 42 | if ($option_array = $control['object']->{$control['method']}()) { |
|
| 43 | // Adding the options array to the XoopsFormSelect |
|
| 44 | $this->addOptionArray($option_array); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | } else { |
|
| 48 | // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 49 | if (isset($control['itemHandler'])) { |
|
| 50 | if (!$control['module']) { |
|
| 51 | // Creating the specified core object handler |
|
| 52 | $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 53 | } else { |
|
| 54 | $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 55 | } |
|
| 56 | } else { |
|
| 57 | $controlHandler = $object->handler; |
|
| 58 | } |
|
| 59 | ||
| 60 | // Checking if the specified method exists |
|
| 61 | if (method_exists($controlHandler, $control['method'])) { |
|
| 62 | // TODO: How could I pass the parameters in the following call ... |
|
| 63 | if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 64 | // Adding the options array to the XoopsFormSelect |
|
| 65 | $this->addOptionArray($option_array); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | } |
|
| 69 | } |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| @@ 41-74 (lines=34) @@ | ||
| 38 | ||
| 39 | parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple); |
|
| 40 | ||
| 41 | if (isset($control['options'])) { |
|
| 42 | $this->addOptionArray($control['options']); |
|
| 43 | } else { |
|
| 44 | // let's find if the method we need to call comes from an already defined object |
|
| 45 | if (isset($control['object'])) { |
|
| 46 | if (method_exists($control['object'], $control['method'])) { |
|
| 47 | if ($option_array = $control['object']->{$control['method']}()) { |
|
| 48 | // Adding the options array to the XoopsFormSelect |
|
| 49 | $this->addOptionArray($option_array); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | } else { |
|
| 53 | // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 54 | if (isset($control['itemHandler'])) { |
|
| 55 | if (!$control['module']) { |
|
| 56 | // Creating the specified core object handler |
|
| 57 | $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 58 | } else { |
|
| 59 | $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 60 | } |
|
| 61 | } else { |
|
| 62 | $controlHandler = $object->handler; |
|
| 63 | } |
|
| 64 | ||
| 65 | // Checking if the specified method exists |
|
| 66 | if (method_exists($controlHandler, $control['method'])) { |
|
| 67 | // TODO: How could I pass the parameters in the following call ... |
|
| 68 | if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 69 | // Adding the options array to the XoopsFormSelect |
|
| 70 | $this->addOptionArray($option_array); |
|
| 71 | } |
|
| 72 | } |
|
| 73 | } |
|
| 74 | } |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||