Blog

Fix menu block showing up even when no subitems in drupal 8 bug

I personally like using the drupal menu block module. It allows for quick creation of submenu's. The following patch fixes a bug that keeps showing regions, even when there are no subitems in the menu block.

Blog

How to set the node created date when importing nodes in Drupal 8

<pre>
<code>$date = strtotime($importObject-&gt;created_at); // which is a date format
$node-&gt;set('created', $date);
// $node-&gt;save(); etc</code></pre>

<p> </p>

Blog

Save node body text html programatically in drupal 8

When saving nodes programmatically, you probably want to set the body to accept html. it is important to set the input format, so html is accepted.

Blog

Run function with drush in drupal 7 with drush php-eval

This is quite a nice feature to run database operations on your website. Found some wrong implementations so I thought I'd share it here.

Blog

Get or set your site uuid with drush in drupal 8

<p>From time to time it comes in quite handy to import configuration from other websites into yours. You site uuid is unique though, with the following snippet you get yours.</p>

<pre>
<code>drush config-get "system.site" uuid</code></pre>

<p>To set the uuid in drush:</p>

<pre>
<code class="language-bash">drush cset system.site uuid 9b13adbf-0da5-4937-a731-xxxxxxxxxxx -y</code></pre>

Blog

Redirect your site to www and https but not locally

<p>A typical setup is one where you would redirect all non www and http requests to https://www.domainname.com. I prefer to keep my .htaccess file in version control also. With the following snippet, I get it the way I want it.</p>

Blog

Get current language programmatically in Drupal 8

<p>The following snippet will return your langcode f.e. 'en', 'nl', etc. Use the following code:</p>

<pre>
<code>// Get current language code
$language = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();</code></pre>

<p> </p>

Blog

Set admin password using drush in drupal

I started using an automated script for my drupal installation, which will generate an admin user. But, after installation I have to edit the password.

Blog

Create system menu link subitem programmatically in drupal 8

I like a good user interface for webmasters, so a clear menu path is necessary. For the admin toolbar dropdowns, I usually create subitems programmatically. 

Blog

How to debug and enable php error reporting in drupal 8

While there are many ways to debug your errors, sometimes just seeing the full errors in your screen works best.

Subscribe to