User login

note

Date field date-only migration from Drupal 7 to Drupal 8

After we did the upgrade of a Drupal 7 site to Drupal 8, a date field which had been taking only the date portion, and no time portion, was now configured to take both the date and the time. Moreover, the migration wasn't working.

We changed the configuration from datetime to date

Here's the relevant part of the diff for config/default/field.storage.node.field_pub_date.yml

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:

Allowing regular (short) text fields to use the multiline textarea form widget

There's a module for that now: https://www.drupal.org/project/textarea_widget_for_text

It's nice and simple with an alter hook (as detailed on the module page) and in this answer.

Implementing Webmentions for Drupal 8

Starting informational links:

Multistakeholder and Platform Cooperatives resources

A core concept of Platform Cooperatives [ http://platformcoop.net/ ] isn't new— the idea that a cooperative enterprise maybe should not be entirely owned and controlled by only workers or only consumers. This kind of cooperative has been called hybrid, solidarity, or multi-stakeholder:

http://www.co-oplaw.org/2014/09/multi-stakeholder-cooperatives/

Using composer require to get an alpha, beta, or release candidate of a Drupal 8 module

The composer require command can help you get your requirements into composer.json more easily. However, that ease is more theoretical than actual for modules without a full stable release.

The Honeypot module has a full stable release version, so any of these will work:

composer require drupal/honeypot:8.*
composer require drupal/honeypot:8.x
composer require drupal/honeypot:8
composer require drupal/honeypot

Drush update not seeing the patch-level version of Drupal 8?

Does it appear that Drush update is not fetching the newest minor version update of Drupal 8? Changelog says 8.0.0 at the top, but you know 8.0.2 has been released, and drush up or drush upc says update information last refreshed that day yet says "No code updates available."?

Spotting and fixing problems caused by referencing the same object in memory

Here's a slightly simplified version of the code causing the problem— very slightly simplified; it really was about this short:

Figuring out what Django permission names are and what permissions a user has

You can see the permissions a particular user has, in the 'machine-readable' form Django uses, quite easily through the Django shell. For a user with the username 'david', for example:

Syndicate content