question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3.x: page modules and the `name` option

See original GitHub issue

Thread pulling time. The facts (that you can correct me on):

  • As an inherited pattern, in A3 all page types can be referenced as @apostrophecms/page. This is because all pages are a single doc type, even if they’re different page types.
  • In 2.x, this same convenience was apostrophe-page.
  • In 3.x, there is a module already named @apostrophecms/page, but in 2.x there is not a module called apostrophe-page (it’s apostrophe-pages).
  • In 3.x, this pattern is implemented in the doc type module, @apostrophe/any-page-type (in 2.x it was apostrophe-custom-pages)
  • To get this all working, any-page-type gets the option, name: '@apostrophecms/page'. Things are already getting confusing…

The problem is appearing as we’re going to remove the name option from doc type modules. It’s rarely used and we can be simpler and more consistent if we use the meta name that most use anyway (self.__meta.name). But because of the convenience covered above, our relationship fields have been using @apostrophecms/page to reference any page. This is complicating removing that option and causing errors.

  • Option 1: We use @apostrophecms/any-page-type to reference all pages instead. The most significant context would probably be in relationship fields. It’s new and thus scary, but is it bad?
  • Option 2: We use another name altogether. I don’t know what.
  • Option 3: We continue to use @apostrophecms/page and figure out how to rig up any-page-type to work without the name option. The biggest argument in favor of this is that all the REST API routes use this “name” as well, so all page stuff uses the same term. It does seem… weird… and maybe bad that we’re using the name of a related-but-different module as the “name” of another module.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
stuartromanekcommented, Mar 2, 2021

Sure, it’s sort of a strange meta name but not unreasonable or bad, and not seemingly wrong when encountered first in documentation, I’d think

1reaction
abeacommented, Mar 2, 2021

Correct. Probably go with the piece manager option since in that context you don’t really care (?) about the page tree. But that’s a problem for another day. The answer for now might be that “any-page-type” is okay since One Day we’ll be able to join to specific page types selectively.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Build a Module | Craft CMS Documentation | 3.x
Set up the basic file structure​​ To create a module, create a new directory for it somewhere within your Craft project, such as...
Read more >
Module configuration options - Apostrophe 3 Documentation
Module configuration options. Apostrophe modules can be configured with settings that influence functionality without having to write custom ...
Read more >
Joomla 3.x : Lesson 3: Add Showcase Module - YouTube
Tutorial lesson explaining how to select, upload, publish and select which pages to display on. The tutorial lesson uses the slideshow ck ...
Read more >
Addons | SP Page Builder (Pro) 3.x - Documentation
This option will allow you to style a particular element in your added addon. Customize and style the particular content and then use...
Read more >
How do I add requirements to a module? - Canvas Community
Mark as done: Students must mark the assignment or page as done before they can progress ... Locate the name of the module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found