Skip to content

Commit

Permalink
Merge pull request #37446 from Digital-Peak/j4/actionlog/events
Browse files Browse the repository at this point in the history
[4.2] Convert log type field to fancy select
  • Loading branch information
roland-d committed Apr 12, 2022
2 parents f24ef9f + 39c5f64 commit af9aa33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions administrator/components/com_actionlogs/config.xml
Expand Up @@ -28,6 +28,7 @@
type="logtype"
label="COM_ACTIONLOGS_LOG_EXTENSIONS_LABEL"
multiple="true"
layout="joomla.form.field.list-fancy-select"
default="com_banners,com_cache,com_categories,com_checkin,com_config,com_contact,com_content,com_installer,com_media,com_menus,com_messages,com_modules,com_newsfeeds,com_plugins,com_redirect,com_scheduler,com_tags,com_templates,com_users"
/>
<field
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\CheckboxesField;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
Expand All @@ -23,7 +23,7 @@
*
* @since 3.9.0
*/
class LogtypeField extends CheckboxesField
class LogtypeField extends ListField
{
/**
* The form field type.
Expand All @@ -49,14 +49,13 @@ public function getOptions()

$extensions = $db->setQuery($query)->loadColumn();

$options = array();
$tmp = array('checked' => true);
$options = [];

foreach ($extensions as $extension)
{
ActionlogsHelper::loadTranslationFiles($extension);
$option = HTMLHelper::_('select.option', $extension, Text::_($extension));
$options[ApplicationHelper::stringURLSafe(Text::_($extension)) . '_' . $extension] = (object) array_merge($tmp, (array) $option);
$extensionName = Text::_($extension);
$options[ApplicationHelper::stringURLSafe($extensionName) . '_' . $extension] = HTMLHelper::_('select.option', $extension, $extensionName);
}

ksort($options);
Expand Down
1 change: 1 addition & 0 deletions plugins/system/actionlogs/forms/actionlogs.xml
Expand Up @@ -20,6 +20,7 @@
label="PLG_SYSTEM_ACTIONLOGS_EXTENSIONS_NOTIFICATIONS"
multiple="true"
validate="options"
layout="joomla.form.field.list-fancy-select"
showon="actionlogsNotify:1"
/>
</fields>
Expand Down

0 comments on commit af9aa33

Please sign in to comment.