- md5
- d3a736b87ba9fcf88e0923e879a27d33
- sha1
- 56f730f7dd162bfb6f3714b98ed6a1e6fd64eaf6
- sha256
- a47041c5dc6953186a22ad370f1349e99d8a76b054b1989ce0cb0165a8f02123
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Form\Field;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Workflow\WorkflowServiceInterface;
/**
* Form Field class for the Joomla Framework.
*
* @since 4.0.0
*/
class WorkflowComponentSectionsField extends ComponentsField
{
/**
* The form field type.
*
* @var string
* @since 4.0.0
*/
protected $type = 'WorkflowComponentSections';
/**
* 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;
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.