Skip to content

Update RadioList.php#101

Merged
kravcik merged 1 commit intomainfrom
radiolist-required-tooltip-
Jun 12, 2025
Merged

Update RadioList.php#101
kravcik merged 1 commit intomainfrom
radiolist-required-tooltip-

Conversation

@kravcik
Copy link
Copy Markdown
Member

@kravcik kravcik commented Jun 12, 2025

No description provided.

@kravcik kravcik requested review from Copilot and vodictomas June 12, 2025 08:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the RadioList PHP control to improve label rendering by adding required class styling and including tooltip support for additional context.

  • Introduces a modified label element with conditional "required" styling.
  • Adds a new tooltip element with Bootstrap tooltip attributes and a FontAwesome icon.

Comment thread src/control/RadioList.php
Comment on lines +149 to +152
$tooltip = $this->getTooltip() === null ?: Html::el('span')
->title($this->getTooltip())
->addAttributes(['data-bs-placement' => 'top', 'data-bs-toggle' => 'tooltip'])
->addHtml(\Kravcik\LatteFontAwesomeIcon\Extension::render('question-circle', color: 'blue'));
Copy link

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip assignment uses a boolean check with the Elvis operator. If getTooltip() returns null, it will set $tooltip to true rather than a tooltip element. Consider rewriting this conditional to properly assign an HTML element only when a non-null tooltip is available.

Suggested change
$tooltip = $this->getTooltip() === null ?: Html::el('span')
->title($this->getTooltip())
->addAttributes(['data-bs-placement' => 'top', 'data-bs-toggle' => 'tooltip'])
->addHtml(\Kravcik\LatteFontAwesomeIcon\Extension::render('question-circle', color: 'blue'));
$tooltip = $this->getTooltip() !== null
? Html::el('span')
->title($this->getTooltip())
->addAttributes(['data-bs-placement' => 'top', 'data-bs-toggle' => 'tooltip'])
->addHtml(\Kravcik\LatteFontAwesomeIcon\Extension::render('question-circle', color: 'blue'))
: null;

Copilot uses AI. Check for mistakes.
@kravcik kravcik merged commit 931c4b3 into main Jun 12, 2025
1 check passed
@kravcik kravcik deleted the radiolist-required-tooltip- branch June 12, 2025 09:31
@danielungu
Copy link
Copy Markdown
Collaborator

@kravcik

image
image

  1. Pokud je tooltip true -> v HTML se vyrenderuje 1
  2. Zanoření setRequired() do podmínek vyrenderuje label bez hvězdičky

Snímek obrazovky 2025-06-17 v 11 42 35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants