- Enable Layout builder
- Turn it on for a news article page
- Theme the page
- We're going to be working on the Press Release template because that content type has fields.
- Without being able to create a custom layout I'm pretty much blocked on this.
- Report your findings
- Enable layout builder
- Assign global blocks to the correct global regions
- Turns out that things were kind of confusing because all of the default blocks where being put in the content region. Moving these out to their appropriate regions (and removing/disabling some) was a necessary step in order to "get my head on straight."
- Manage layout for News Article content type
- This is somewhat confusing especially without seeing the header and footer clearly defined.
- Using the page title doesn't seem to actually print the page title when I save the layout. This could be because the page title is already being rendered above that.
- I need to figure out how to add layouts to layout builder.
- When trying to place the subtitle in a region above the rest of the content it's extremely difficult and rather annoying to try and move past the different options. Also it took me a minute to remember that I cannot "place fields" the way that I would place a block, but in stead I have to drag them from their current place to the desired place. Generally speaking, long text fields are just extremely difficult to maneuver to the correct location.
- On the default layout, all of the fields are being set with some filler content, so all content is extended to some of it's longest possible options.
- Moved the subtitle to a new region, attempted to configure it to hide the label (which never seemed to disappear from the default layout - I assumed this happened because it was there to say what that was regardless since otherwise it's all just lorem ipsum), and this seems to have broken all of the layouts for that content type resulting in the following error:
Drupal\Component\Plugin\Exception\ContextException: Required contexts without a value: entity. in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 96 of /var/www/ama-d8.local/docroot/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php).
- So I'm not really sure what's going on there but that needs some more testing
- It looks like when I try to configure the Subtitle field to hide the label that the AJAX doesn't quiet fire and actually save the settings when I click the button. Reloading the page has resulted in a WSOD (same error as above). When this happens the best result I have is to re-import my last saved config in order to get rid of the error.
Originally I didn't want to turn on Field Layout because I'm not too sure of what it does. But it seems that I can't place specific fields in different layout sections unless this is on.
Turning it on has created a WSOD, however clearing caches seems to have resolved it.
According to this video, there should be a "Layout Library" module that allows you to create custom layouts through the admin UI. However, this module isn't included in core. When google-ing some I found:
Layout Library with no release information. It says that the requirements are Layout Discovery, Layout Builder and Field Layout. I currently meet all of those requirements locally. In the "known problems section you see":
It will eventually become a for-real project. See the issue queue for remaining work. Please use the issue queue to report any issues.
There are a handful of issues in the queue one major, the rest are normal. The major one hasn't been updated in weeks and the normal ones haven't been updated in months. Without this functionality I'm not sure how I can define custom layouts for layout builder.
In order to test it out I cloned the branch. This would be something we would have to either create our own custom module for or contribute back to this module in order to get it included in core or as a contrib module. We may want to see if Lee is at DrupalCon and discuss what the path for this is with him there, if we're interested in getting the AMA team involved.
- See comments above to acquire the Layout Library module
- Enable the module
- Navigate to
/admin/structure/layouts
- Click "Add Layout" button
- Set the label and entity bundle to use the layout and Click "Save"
- At this point the page gets a WSOD with the error
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "layout_builder.layout_library.node.view" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 202 of /var/www/ama-d8.local/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php).
- This issue has already been logged in the issue queue, but there is little action and no resolution at this time.
- According to the video:
This is done by creating a plugin that implements the section storage plugin interface and essentially you're just responsible for telling Drupal that okay this is a new way of storing layout that's associated with the particular paradigm. Once you implement the interface and tell us some paths for the routing you can essentially use the same way I build and install however you like. So, the default storage for example of manage display is it's stored in the view display entity. So the config entity that's deployed when you do manage display. The implementation for the article level is it's stored in a field on the content entity....
- Basically rambling and then "look at examples from the core layouts"
- At this point the page gets a WSOD with the error
- Create a layout
- Navigate to
core/modules/layout_discovery.layouts.yml
- Copy this and pull it into the theme to define the layout options for that theme.
- Give it a name and label
- List the regions
- With that provide a twig template
- Output the regions in the twig template
- Navigate to
So I've gone through and created a ama-one.layouts.yml
and the layout file for what would be the Press Release, but I still cannot seem to get past the routing error. I have included the code that I wrote for the layout but I didn't include the config. Also the module would have to be manually added elsewhere.