Skip to content

Conversation

@Spilky
Copy link
Contributor

@Spilky Spilky commented Oct 12, 2022

  • \Nette\Forms\Controls\Checkbox::getControl returns label part and control part like one \Nette\Utils\Html and then $control->getControl()->getAttribute('class') is always null (because it takes class from label) and custom defined classes are always overwritten by $control->setAttribute('class', 'form-control input-sm form-control-sm');
  • fixed by using \Nette\Forms\Controls\BaseControl::getControlPrototype which always returns only control part without label part

@MrVoltz
Copy link

MrVoltz commented Nov 20, 2022

I am having the same issue, I think that in addition to your fix, there should be a condition for TextBase and SelectBox.

@radimvaculik
Copy link
Member

Good for me! 👍 @paveljanda / @f3l1x Please merge it.

@f3l1x
Copy link
Member

f3l1x commented Jan 10, 2025

Please rebase your PR.

@Spilky Spilky force-pushed the inline-edit-checkbox-classes-bug branch from d22f09e to bbbd24e Compare January 14, 2025 15:26
@Spilky
Copy link
Contributor Author

Spilky commented Jan 14, 2025

@f3l1x done. There is error for PHPStan and it is not related to my PR:

Error: Ignored error pattern #^Parameter \#1 \$x of method Doctrine\\ORM\\Query\\Expr\:\:like\(\) expects string, Doctrine\\ORM\\Query\\Expr\\Func given\.$# in path /home/runner/work/datagrid/datagrid/src/DataSource/DoctrineDataSource.php was not matched in reported errors.

@radimvaculik
Copy link
Member

@Spilky Fixed @ #1158

- `\Nette\Forms\Controls\Checkbox::getControl` returns label part and control part like one ``\Nette\Utils\Html` and then `$control->getControl()->getAttribute('class')` is always null and custom defined classes are always overwritten by `$control->setAttribute('class', 'form-control input-sm form-control-sm');`
- fixed by using `\Nette\Forms\Controls\BaseControl::getControlPrototype` which always returns only control part without label part
@Spilky Spilky force-pushed the inline-edit-checkbox-classes-bug branch from bbbd24e to 1e25300 Compare January 23, 2025 15:32
@Spilky
Copy link
Contributor Author

Spilky commented Jan 23, 2025

@radimvaculik @f3l1x rebased again. All checks are successful. Please merge it.

@f3l1x f3l1x merged commit f93a0ac into contributte:master Jan 23, 2025
8 checks passed
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