User login

How to

Information on how to do something... anything.

How to install Riot desktop (Matrix client) on Debian-based systems

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.

Place a block in a Paragraph in Drupal 8

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.

Easily add content with update hooks: use default content module exports to create content that needs to be in sync with configuration

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.

Getting a node (or other entity) and playing with it on the command line

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:

Keeping Drupal's contextual links working even when the whole content item is linked offsite or triggering a lightbox

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:

Give custom blocks template suggestions by type and views blocks by view ID

<?php
/**
 * Implements hook_theme_suggestions_HOOK_alter() for blocks.
 */
function kidneys_theme_suggestions_block_alter(array &$suggestions, array $variables) {

How to get the base path for your Drupal 8 site in a Twig template

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.

Embedding a content add form in a block in Drupal 8

The Form block module, mentioned in the Drupal.org forum post how to embed node add form in a block?, is still going strong in Drupal 8.

https://www.drupal.org/project/formblock

Drupal 8 default content the Agaric way

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).

Syndicate content