How to
Information on how to do something... anything.
Tested on Debian Mint edition, but this should work for Ubuntu too.
These instructions assume you are willing and able to use the command line— that is, open a terminal and type these lines of commands. Unlike the the official desktop install information, these instructions don't assume you already know and remember how to add a new remote source to your package manager and install from it.
If you have a block that does something useful, or even has content in it that you'd like to reuse, and you are using Paragraphs on your site
The Drupal 8 port of Block reference has generated a lot of discussion.
The last comment at this time suggested that inclusion of the ability to Add a block plugin field formatter being in Plugin module should do it.
An approach for keeping content that is added as part of development synchronized with test and production environments is to use the Default Content module to export the content. It's built for the content to be exported to an installation profile's 'content' folder, and then the module, if enabled, automatically brings the content in when the site is installed.
Here's one way to get a node so that you can play with it on the command line and figure out what different methods actually do:
array_pop(\Drupal::service('entity_type.manager')->getStorage('node')->loadByProperties(['title' => 'Sample node']))
There's surely faster ways to do it with an ID, and maybe even better would be to use devel generate here. Anyway, this gives a node that can be messed with, like so, putting it all together:
We have a site where one content type (publicity, for news items and awards) are listed, but the whole thing is wrapped in an anchor tag and linked to outside content. To prevent leaving the site before the contextual edit link is shown, i did this:
<?php
/**
* Implements hook_theme_suggestions_HOOK_alter() for blocks.
*/
function kidneys_theme_suggestions_block_alter(array &$suggestions, array $variables) {
In page.html.twig you will have a working {{ base_path }}
variable. Why it isn't available in every template, i have no idea. As i think it should be and everything else looks messy, my preferred solution is to do exactly as Drupal does in the preprocess page function for any place i need it.
For the moment, we're following the crowd and using the Default content module. It is nice and has built-in integration with installation profiles, but the export could be more convenient (multiple items of content at once, please!) and import could be made much more robust (given half a chance, we'll reimplement it on migrate).