This website is composed of information connected through taxonomy. It is simultaneously a proof-of-concept and a means to allow Agaric to share and store information both within the collective and the world as part of our open documentation philosophy.

User login

This website is composed of information connected through taxonomy. It is simultaneously a proof-of-concept and a means to allow Agaric to share and store information both within the collective and the world as part of our open documentation philosophy.

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:

So if you think there's a crazy bug in permission to access text formats...

...it's probably because there is already content in the text area that is set to something to which the user no longer has access.

It seems really freaky when you have access to one text format, and it says:

"This field has been disabled because you do not have sufficient permissions to edit."

So you add another text format, and now you have access to the field... and the format it must have been saying you didn't have permissions for before, what???

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

Argument 2 passed to hook help() must be an instance of RouteMatchInterface

I got this error message, that argument two passed to my module's implementation of hook_help() "must be an instance of RouteMatchInterface, instance of Drupal\Core\Routing\CurrentRouteMatch given", and it's a misleading one.

CurrentRouteMatch in fact (unsurprisingly) implements the RouteMatchInterface. The problem was i hadn't actually defined CurrentRouteMatch— i needed to have a use statement at the top of my module (or use the full PSR4 path in the parameter definition of the hook implementation, but i went with the former). Like so:

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

Resources for visual accessibility of web sites

Presented by Catharine McNally at TCDrupal2016

Color blindness simulator

http://www.color-blindness.com/coblis-color-blindness-simulator/

If the design fails to work well in simulator, send it back, before implementation.

4.5% of world is colorblind: 8% of men, 0.5% of women.