Skip to main content

Blog

Drupal 8: Theme suggestions for content type AND view mode.

I was trying to theme a specific vocabulary and a specific view mode and the suggestions, by default, didn't allow for this. After some searching I came across this article, which mentioned using the hook:

hook_theme_suggestions_HOOK_alter().

So, I added the function below in my .theme file to make the following template suggestion available: 'taxonomy_term__VOCABULARY__VIEW_MODE'


Drupal 8: Cautions in Configuration Management

I was working on a new Drupal 8 site and had a new geolocation view setup to show locations on a Google map. Everything was working well, then I decided I wanted to add a new field to the node and include that field in the view. After adding the field to the view, I decided against using it and deleted the field from the node (before removing it from the view). This, in turn, deleted the entire view, which cost me a days worth of work! I had not exported my configuration prior to adding this field, so I had no way of getting my view back without restoring my database from Time Machine.


GlusterFS Network Issues

Not sure what happened with GlusterFS tonight. Around 19:07 EST, the AWS alarm sounded. After rebooting the GlusterFS servers and the web servers, nothing was bringing the sites back online. There was a terrible lag when accessing the GlusterFS file systems and there weren't any glaring errors in the log files.


Linux copying many files from many paths into one directory

Today I had the task of gathering files from a Drupal website into an archive to send to a client. The files were stored in the database and were spread out across the public files and the private files directories. In order to create an archive and prevent the client from manually clicking on 1000 file download links, I did the following.


Programmatically alter a Drupal menu without disabling access to the page.

I came across a need to keep a menu link active, but, I didn't want it to be displayed to the anonymous user. After much searching I found the hook_menu_link_alter() function and the hook_translated_menu_link_alter() function.

With these functions, I was able to alter the menu item that I wanted to not display with hook_menu_link_alter():


Preserving Role ID (rid) in a Drupal 6 to Drupal 7 Role Migration

I was working on setting up a role migration from Drupal 6 to Drupal 7. After some time, I noticed that the role id's were not being preserved, which was going to cause a problem for me when I went to take the migration to the live server. I initially tried using the addFieldMapping function to link the source rid to the destination rid (similar to preserving the nid for nodes or the uid for users). However, this failed to save any of the roles during migration.