Problem/Motivation

It looks like there's quite a bit of refactoring of logic/code still planned for the Settings Tray module.

Before BigPipe was marked stable, we marked all classes & interfaces @internal, because BigPipe provides only functionality, not APIs.

I think that you probably want to do something similar for Settings Tray? I think you want to limit the API surface in a very clear, very simple way:

Any block that provides an off_canvas form in their block plugin annotation, is automatically picked up.

(Plus probably something for making things other than blocks configurable via the Settings Tray.)

Proposed resolution

  1. Mark as much as possible as @internal. That would include all PHP code, all HTML (Twig templates), all JS, all CSS. The only thing that's an API, is the declaration of "off_canvas forms".
  2. Add a outside_in.api.php file to document the actual API.

(And yes, off_canvas should be renamed to settings_tray, but that's probably part of #2803375: Rename Outside-in module to "Settings Tray" for real.)

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

Wim Leers’s picture

This would mean that big tasks like #2784935: Use Backbone for client-side state management can happen even after the module is marked stable.

tedbow’s picture

Status: Active » Needs review
FileSize
10.07 KB

Here is a patch.

tedbow’s picture

The only thing that's an API, is the declaration of "off_canvas forms".

and

Add a outside_in.api.php file to document the actual API.

The way we are marking form as off_cavnvas is in outside_in_block_alter but this is because these are existing blocks.
For a module that define it's own blocks it would be more correct to update add an 'off_canvas' form handler in their blocks plugin file.

How would that be documented in an .api.php file?

GrandmaGlassesRopeMan’s picture

Status: Needs review » Needs work
+++ b/core/modules/outside_in/js/off-canvas.es6.js
@@ -5,6 +5,8 @@
+ * @internal

JSDoc does not use @internal. I'd suggest using @private or @protected depending on the actual goal of this documentation.

GrandmaGlassesRopeMan’s picture

GrandmaGlassesRopeMan’s picture

Status: Needs work » Needs review
xjm’s picture

Not RTBC-blocking, but we should definitely have a framework manager review this one.

+++ b/core/modules/outside_in/css/outside_in.tabledrag.css
@@ -3,6 +3,9 @@
  * @see tabledrag.js
+ *
+ *
+ * @internal

+++ b/core/modules/outside_in/css/outside_in.theme.css
@@ -1,6 +1,9 @@
  * Visual styling for Settings Tray module.
+ *
+ *
+ * @internal

Are there supposed to be double blank lines here?

xjm’s picture

+++ b/core/modules/outside_in/src/OutsideInManager.php
@@ -8,6 +8,8 @@
 class OutsideInManager implements OutsideInManagerInterface {

+++ b/core/modules/outside_in/src/OutsideInManagerInterface.php
@@ -4,6 +4,8 @@
 interface OutsideInManagerInterface {

If it's purely internal code, then why is there an interface for it?

xjm’s picture

@xjm is apparently a broken record. See #2835604-14: BigPipe provides functionality, not an API: mark all classes & interfaces @internal and @Wim Leers' reply in #15 following.

xjm’s picture

Wim Leers’s picture

Status: Needs review » Needs work

#5

How would that be documented in an .api.php file?

See core/core.api.php for plenty of examples of how to describe things in words, and not just using hook_modulename_blah().

#10++ — could not agree more.

Wim Leers’s picture

xjm’s picture

Issue tags: +Needs followup

Can we remove that interface, or spin off a separate issue to do so? Marking an interface @internal just seems like conflicting information, or "letter but not the spirit", outside of some weird/edgecase scenarios. Ideally we'd do both this and that before marking Settings Tray beta and I guess it wouldn't need to block this (we did it as a followup for BigPipe) but it does cause mental discordance for me in this patch. :P

Wim Leers’s picture

Issue tags: -Needs followup

#15: #2844261: Allow dialog links to specify a renderer in addition to a dialog type removed that interface altogether, so it's already taken care of :)

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

AFAICT this is ready. I have nits:

  1. +++ b/core/modules/outside_in/css/outside_in.details.css
    @@ -1,8 +1,9 @@
    -
    
    +++ b/core/modules/outside_in/css/outside_in.form.css
    @@ -1,8 +1,9 @@
    -
    

    I think these deletions are accidental.

  2. +++ b/core/modules/outside_in/css/outside_in.tabledrag.css
    @@ -3,6 +3,9 @@
      * @see tabledrag.js
    + *
    + *
    + * @internal
      */
    
    +++ b/core/modules/outside_in/css/outside_in.theme.css
    @@ -1,6 +1,9 @@
      * Visual styling for Settings Tray module.
    + *
    + *
    + * @internal
    

    @xjm already asked about this in #9.

… but they're not commit-blocking IMHO. Especially not for @internal things.

xjm’s picture

Let's get that followup filed and remove the blank lines whitespace changes at least. :)

Edit: I fail at reading. @Wim Leers clarified that the interface has already been removed and I confirmed this in the codebase. :)

Edit 2: But let's still remove the whitespace changes. It's fine to leave it at RTBC for such a trivial cleanup, but leaving things for committers to do on commit can be error-prone and adds more work to the commit process. :)

xjm’s picture

Also a note that I'm not totally confident about the way we're marking the templates internal. That pattern doesn't exist anywhere in core. Bartik and Seven are considered internal, but that's indicated in their .info files rather than their templates. Similarly, I didn't find any examples of CSS files being marked internal in this way. I pinged @lauriii and @Cottser about it.

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Discussed this with @Cottser. I also realized that module templates and CSS are considered internal anyway, by default, and we don't have a best practice for marking that yet anywhere. So let's remove the CSS and template hunks from this patch, and just keep the PHP and JS hunks.

I posted about both that question and the JS @private use here: #2550249: [meta] Document @internal APIs both explicitly in phpdoc and implicitly in d.o documentation

tedbow’s picture

Status: Needs work » Needs review
FileSize
5.22 KB
3.44 KB

@xjm ok here is just the PHP and JS files.

re #17 and #18.2 all extra lines where in CSS files so not problem anymore

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

#20: Thanks for explicitly confirming that templates and CSS are always internal. I'd rather see the patch try to mark too much internal and then a committer marking NW for marking too much internal than marking too little, because then the record (this issue) documents the intent in case rules change later :)

Back to RTBC, #21 looks great!

  • xjm committed a0d0f7c on 8.4.x
    Issue #2894584 by tedbow, drpal, Wim Leers, xjm: Settings Tray provides...
xjm’s picture

Title: Settings Tray provides functionality, not an API: mark everything (PHP+JS+CSS+HTML) as @internal » Settings Tray provides functionality, not an API: mark PHP and JS as @internal

Forgot to save retitling the issue before commit.

  • xjm committed 40d1a11 on 8.4.x
    Issue #2894584 by tedbow, drpal, Wim Leers, xjm: Settings Tray provides...
  • xjm committed 99e112f on 8.4.x
    Revert "Issue #2894584 by tedbow, drpal, Wim Leers, xjm: Settings Tray...
xjm’s picture

Title: Settings Tray provides functionality, not an API: mark PHP and JS as @internal » Settings Tray provides functionality, not an API: mark PHP and JS as internal
Status: Reviewed & tested by the community » Fixed

Committed to 8.4.x, thanks!

An 8.3.x backport would look different because of the JS file locations. It could be backported since it's just documenting the correct state of this functionality, but leaving against 8.4.x now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tedbow’s picture

Component: outside_in.module » settings_tray.module

Changing to new settings_tray.module component. @drpal thanks for script help! :)