Repository navigation
Forms: help in a box, the help_style option - #29
Merged
Merged
Conversation
recomaty-panel#682 drew every help of its device settings form as a lighter box under the field, in the form's own text size, with a form theme and a stylesheet of its own. Bartosz asked for it to be a setting of adminata, so that the panel needs no override. - Form\Extension\HelpStyleTypeExtension (new, on FormType): the `help_style` option, `plain` or `box`, null by default. A form or field without one takes its parent's resolved style, so an admin sets it once in configureFormOptions() and its fields, sub-forms and collection entries (the prototype too) follow; one at the top takes the new `options.help_style` (default `plain`). The resolved style is the view variable `help_style`. Service `adminata.admin.form.extension.help_style`, its argument set by AdminataExtension from the option. - form_admin_fields.html.twig, form_help: `box` puts `adm-help-box` where `adm-help` was. `adminata-field-help`, the help's id and its place under the control and the errors stay; `plain` renders exactly as before. - components/misc.css: `@utility adm-help-box` (gray-50 with a gray-100 border, gray-600 text at --text-theme-sm, the control's radius; dark: white at 5% over the card, gray-800 border, gray-400 text), and in `@layer components` the markup of `help_html` inside it: h3/h4, paragraphs, ul/ol with their markers, b/strong, code. - app.css rebuilt; safelist and contract.json regenerated (`.adm-help-box`). - Tests: HelpStyleTypeExtensionTest (default, inheritance down to a collection prototype, a field or sub-form picking the other style, unknown values refused), AdminLayoutTest (the box class on the help, a form's box on its fields' rows with markup help and a help_class), ConfigurationTest, AdminataExtensionTest (the argument and the tag), the config reference and the option shape tests. - Docs: "Help in a box" in action_create_edit.rst, the configuration reference, UPGRADE-1.0's new nodes; CHANGELOG entry under Added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment added in 5bc5705 trimmed the whitespace around it (`{#- … -#}`), which pulled the help's `<div>` of every form left by sixteen spaces. Nothing reads that whitespace on a page, but the demo's JS fixtures are its exact HTML, and JsFixtureDumperTest found the product-create fixture stale. A plain `{# … #}`, as the comment it replaced was, leaves the output of `help_style: plain` byte for byte what it was before the option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bpacholek
marked this pull request as ready for review
October 28, 2026 11:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A field's help in adminata is one small grey line under the control (
adm-help, 12px). In recomaty-panel the device settings form (recomaty/recomaty-panel#682) needed more: long explanations and lists of template placeholders read better as a lighter box under the field, in the form's own text size. The panel's prototype drew that box with a form theme and a stylesheet of its own. @bpacholek asked for it to be a setting of adminata, so that the panel needs no override. This PR adds that setting.5bc570570Thehelp_styleoption (Form\Extension\HelpStyleTypeExtension, new, extendsFormType; serviceadminata.admin.form.extension.help_style):plain(the default, today's look) orbox; the option itself defaults tonull.configureFormOptions()($formOptions['help_style'] = 'box';). Its fields, sub-forms and collection entries follow, the collection prototype too. A single field can still pick the other style.adminata.options.help_style(defaultplain). Setting it toboxturns the box on for every form of an application.help_style.AdminataExtensionpasses the option to the extension as its default.Form/form_admin_fields.html.twig,form_help): withbox, the help's classadm-helpbecomesadm-help-box.adminata-field-help,help-text, the help's id,help_classand the help's place (under the control and its errors) stay as they are. Withplainthe output is byte for byte what it was, and the existing layout tests and the demo's JS fixtures pass unchanged.f09b04785: the first commit's comment inform_helptrimmed the whitespace around it ({#- … -#}). That shifted the help's<div>left in every form, andJsFixtureDumperTestcaught it (the product-create fixture). It is now a plain{# … #}, like the comment it replaced.components/misc.css):@utility adm-help-box: margin 0.5rem; padding 0.75rem 1rem; a gray-100 border with the control's radius; a gray-50 background; gray-600 text at--text-theme-sm(the label's and the control's 14px). In the dark theme: a gray-800 border, white at 5% over the 3% card, gray-400 text.@layer components: the markup ofhelp_htmlinside the box (h3/h4, paragraphs,ul/olwith their markers,b/strong,code), which the preflight leaves unstyled.app.cssis rebuilt;safelist.cssandcontract.jsonare regenerated (one new selector,.adm-help-box).reference/action_create_edit.rst, the configuration reference, and UPGRADE-1.0's table of new nodes. CHANGELOG: one entry under[Unreleased]→### Added.Contract
options.help_style, defaultplain), a new service id, a newadm-*utility, and a new view variable. No template, block, hook, registry key or existing node changed meaning. The default rendering is unchanged.tests-adminata/Contract/config-reference/adminata.yamlhas the new node (3 lines), asConfigContractTestrequires.make check-names: clean.Tests
tests/Form/Extension/HelpStyleTypeExtensionTest.php(new):plain, orboxwhen constructed so).boxreaches its field, a sub-form's field, a collection entry and the collection's prototype.tests/Form/AdminLayoutTest.php:testHelpInABox:adm-help-box adminata-field-help help-texton the help.testAFormsBoxReachesItsFieldsRows: a field with no style of its own, rendered as a row, takes its form's box.help_htmlstays markup and a row'shelp_classis kept. A field without help gets no box.ConfigurationTest: the default isplain,boxis accepted, andsideis refused with the path in the message.AdminataExtensionTest: the service, its tag and its argument from the option.AdminataConfigurationTest,RenderElementRuntimeTestandRenderElementExtensionTesthave the new key.Gates (local)
npm ci, thennpm run build: onlyapp.css,safelist.cssandcontract.jsonchange. Stylelint (misc.css),css:layers, Prettier,css:contract(139 selectors) andsize(app.css 70.27 kB of 120 kB): all OK.lint:twig(Form),lint:container,check-names: OK.assertEmpty()inConfigurationTest::testDashboardWithoutRoles, which is onmainalready. None from this change.admin+adminata-unit: 2377 tests, no failures. 3 errors, all three inDoctrineODMQuerySourceIteratorTest, because this machine has no MongoDB server.adminata-contract: 191 tests, OK.CI (
f09b047)mongo:8service container does not start on the runner ("MongoDB cannot start: Linux kernel versions 6.19 and newer has a known incompatibility", SERVER-121912).main's latest MongoDB fork run at078d2b1fails the same way. On5bc5705the MongoDB fork suite was green and "PHP 8.4 + highest" failed only on the fixture whitespace thatf09b047fixes. Both need a re-run once the runner's MongoDB starts again.main's latest Quality assurance run at078d2b1; the error lists match message for message.main(theConfigurationTestfinding moved down 15 lines with the new test).Part of recomaty/recomaty-panel#682. The panel's draft PR, recomaty/recomaty-panel#684, moves its
composer.lockto this branch's commit, so the change can be seen there before this one is merged. It turns the box on for the device settings form alone and drops its own form theme and stylesheet. After the merge, the panel's lock moves to the merge commit.Bober's change for recomaty/recomaty-panel#682, made at Bartosz's request.
🦫 ~Bober