Back to WorkflowComponentSectionsField class

Method getOptions

protected array
getOptions
()
Method to get a list of options for a list input.
Returns
  • array An array of JHtml options.
Since
  • 4.0.0

Method getOptions - Source code

/**
 * Method to get a list of options for a list input.
 *
 * @return	array  An array of JHtml options.
 *
 * @since   4.0.0
 */
protected function getOptions()
{
    $app = Factory::getApplication();
    $items = parent::getOptions();
    $options = [];
    $options[] = HTMLHelper::_('select.option', ' ', Text::_('JNONE'));
    foreach ($items as $item) {
        if (substr($item->value, 0, 4) !== 'com_') {
            continue;
        }
        $component = $app->bootComponent($item->value);
        if (!$component instanceof WorkflowServiceInterface) {
            continue;
        }
        foreach ($component->getWorkflowContexts() as $extension => $text) {
            $options[] = HTMLHelper::_('select.option', $extension, Text::sprintf('JWORKFLOW_FIELD_COMPONENT_SECTIONS_TEXT', $item->text, $text));
        }
    }
    return $options;
}