Xplain for Craft CMS

Configuration

Settings live under Settings → Plugins → Xplain, or in config/xplain.php:

<?php

return [
    'autoWrite' => true,
    'showToEveryone' => false,
    'tipsPerField' => 1,
    'includeQuery' => false,
    'excludedFields' => ['seoTitle', 'legacyBody'],
];
SettingDefaultWhat it does
autoWritetrueRewrite tips when a field or layout is saved or a field is deleted, and on install. Only ever where project config is writable.
showToEveryonefalseShow Xplain's tips to every author. Off, they show to admins and to users with the See Xplain's developer tips permission.
tipsPerField1How many pieces of advice follow the Twig line in each tip, 0–3. The field screen always shows all of them.
includeQueryfalseAdd an element-query line for field types that have one, e.g. .featured(true).
excludedFields[]Global field handles Xplain leaves alone.

Who sees the tips

A layout element's tip renders for everyone who opens the form. Xplain's tips are Twig and query advice, which is noise to an author writing a headline, so by default Xplain removes its own tips from the form for anyone who is not an admin and lacks the See Xplain's developer tips permission (under Xplain in user group permissions).

Tips a person wrote are never hidden. The filtering happens when the form is built; nothing in project config changes.

Excluding fields

An excluded field gets no new tip. A tip Xplain already wrote for it stays until you remove it:

php craft xplain/tips/clear --field=seoTitle

Changing the settings changes the tips

tipsPerField and includeQuery change what Xplain would write, so after changing either, every Xplain tip is out of date. Run php craft xplain/tips/write, or save any field and let the queued job do it.