Skip to content

Commit

Permalink
Add inlineHelp toggle button control
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrezdev authored May 17, 2022
1 parent 9f8b824 commit 288c69e
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit 288c69e

Please sign in to comment.