Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX #37772 - inlineHelp Toggle Button control #37819

Merged
merged 4 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions administrator/components/com_config/forms/application.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<config>
<inlinehelp button="show"/>
</config>
<fieldset
name="cache"
label="COM_CONFIG_CACHE_SETTINGS_LABEL">
Expand Down
2 changes: 1 addition & 1 deletion layouts/joomla/form/renderfield.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
$id = ($id ?? $name) . '-desc';
$hideLabel = !empty($options['hiddenLabel']);
$hideDescription = empty($options['hiddenDescription']) ? false : $options['hiddenDescription'];
$descClass = ($options['descClass'] ?? '') ?: 'hide-aware-inline-help d-none';
$descClass = ($options['descClass'] ?? '') ?: (!empty($options['inlineHelp']) ? 'hide-aware-inline-help d-none' : '');

if (!empty($parentclass))
{
Expand Down
22 changes: 22 additions & 0 deletions libraries/src/Form/FormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ abstract class FormField
*/
protected $hiddenDescription = false;

/**
* Should the description be hidden/shown with toggle button when rendering the form field?
*
* @var boolean
* @since 4.1.4
*/
protected $inlineHelp = false;

/**
* True to translate the field label string.
*
Expand Down Expand Up @@ -1067,6 +1075,20 @@ public function renderField($options = array())
}
}

if (empty($options['inlineHelp']))
{
if ($this->getAttribute('inlineHelp'))
{
$options['inlineHelp'] = $this->getAttribute('inlineHelp') == 'true';
}
else
{
$options['inlineHelp'] = isset($this->form->getXml()->config->inlinehelp['button'])
? ((string) $this->form->getXml()->config->inlinehelp['button'] == 'show' ?: false)
: $this->inlineHelp;
}
}

if ($this->showon)
{
$options['rel'] = ' data-showon=\'' .
Expand Down