User login

How to

Information on how to do something... anything.

Embedding a content add form in a block in Drupal 8

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

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

What to do when developing a Drupal 8 module and a class file just isn't being autoloaded even though it is definitely there

Short answer: Restart apache or disable the APC classloader in your local.settings.php (see settings.php).

While working on the Give module, which follows the same pattern for donation forms as Drupal 8 core's Contact module uses for contact forms, an access control handler was not being found even though i quadruple checked that my handler annotation described the handler correctly for the name and location of its file.

The ConfigEntityType annotation for the access handler, with most other annotations removed:

Is Git corrupting your font files?

I was getting errors like this in the console:

downloadable font: incorrect file size in WOFF header (font-family: "Graphik" style:normal weight:bold stretch:normal src index:1) source: ... themes/butaro/fonts/Graphik-Bold-Web.woff
downloadable font: rejected by sanitizer (font-family: "Graphik" style:normal weight:bold stretch:normal src index:1) source: ... themes/butaro/fonts/Graphik-Bold-Web.woff

Git would have given you warnings that look like this when you git added the fonts:

Saving message entities programmatically

Our use case, re-saving existing messages, is a bit more complex than it should be, but not bad. This code will work for new or existing messages.

Where $exports is an array of long text strings that is each the JSON dump received form exporting a message type through the UI:

Setting text format per field in Drupal 8

UPDATE: There is a contributed Drupal 8 module to set allowed formats that was spun off of the core issue to allow text field to enforce a specific text format.

Right now, there's no good way to do it, but there's good hope that this issue will be fixed in Drupal 8 core. OK but right now? Better Formats isn't stable for Drupal 8 yet. So hacky custom form alters is the best i've come up with.

Installing current Inkscape on Debian or Linux Mint Debian Edition

As of 2016, stable Debian repositories still have a very old version of Inkscape (0.48.5-3 in the default repos). The testing and unstable branches of Debian have the current recommended release, however, so it's quite simple to get it on your Debian:

Set a separate browser window page title from HTML page title (Drupal 7)

This code shows how to set the browser bar page title the Page Title module way, without that module. (This was motivated simply because we were already gathering the info for another purpose in hook_node_view_alter(); there's no reason not to use Page Title!)

Overriding Django's admin template from a custom app

If you have tried to override an administrative template in Django using the app directories template loader functionality, you may have found yourself growing frustrated— I mean, you may have found yourself going insane.

The problem was acknowledged but

The order of INSTALLED_APPS is significant! Translations and Templates in Django can be overridden; the first app found will have priority.

Syndicate content