Tag: drupal

  • Drupal 8: Configure block or Place Block do nothing

    In short, clicking on “Place Block” results in a brief loading icon and then nothing, and Configure Block results in a “This website encountered an unexpected error” message. The fix was found here:

     

    https://www.drupal.org/node/2597506

     

    Edit the following file – the “core” directory should be in your Drupal 8 root directory:

     

    [drupal root]/core/lib/Drupal/Core/Annotation/Translation.php

     

    Before the final }, add the following text:

     

    public function __toString() {
    return $this->translation->__toString();
    }

     

    Now try placing a block again and it should work. Please note that until this change is added to the Drupal code this is probably going to revert when you upgrade Drupal.

  • Drupal 8 – How to enable multi image upload

    One of the great things about Drupal 8 is that it has multi-image uploading capabilities built-in, unlike Drupal 7. By default, however, it’s a single image at a time.

     

    To enable multiple image upload for articles, for example, navigate to:

     

    siteurl/admin/structure/types/manage/article/fields

     

    Drupal 8 - Enabling Multiple Image Uploads

    Click “edit” next to the Image field type, and you’re taken to:

     

    Screen Shot 2015-11-19 at 3.27.02 PM

    Click on “Field Settings” and scroll down until you see:

     

    Screen Shot 2015-11-19 at 3.27.54 PM

    Set to “unlimited” as in the above image, save, and you should be good to go!

  • Installing Aegir 3 on Debian 8 Jessie/Ubuntu with Nginx

    So, after a few failed attempts at installing the Aegir 3 Drupal control system we hit upon this “recipe” as what works for us currently on a fresh install of Debian 8 Jessie or Ubuntu 14.04.

    This assumes you are logged in as root. First, update and upgrade your system.

    apt-get update && apt-get upgrade -y

    For the version of OS that currently gets installed with a fresh Binary Lane VPS we also need to update the base system. We like to use aptitude for that; while we’re installing aptitude, we might as well install the other thing that Aegir needs to install properly:

    apt-get install curl sendmail aptitude -y

    Upgrade:

    aptitude safe-upgrade -y

    Now, we need to install the database server. We use MariaDB.

    apt-get install mariadb-server -y

    One that’s done – you will be prompted to enter a root password for the database – we run the following command:

    mysql_secure_installation

    Don’t worry about changing the root password now that you have already set one, but delete the test database when prompted, disable anonymous access and flush privileges. Now we can install Aegir, nginx, php5-fpm etc.:

    echo “deb http://debian.aegirproject.org stable main” | sudo tee -a /etc/apt/sources.list.d/aegir-stable.list
    curl http://debian.aegirproject.org/key.asc | sudo apt-key add –
    apt-get update
    apt-get install aegir3 aegir3-provision aegir3-hostmaster nginx php5-fpm

    Enter the hostmaster URL – usually the fully qualified domain name. Enter the database root password once for provision and once for hostmaster.

    Assuming all of the above has gone well, you should be given a one-time-login link in your terminal at the end of the install process, e.g.:

    http://aegir.example.com.au/user/reset/1/1446598196/Nw4T4yd25IWEngCP2d2A_Ck3XslBiobnhbuNzXU4/login

    Now, before using that run the following:

    visudo

    Add this to the end of the file:

    Defaults:aegir !requiretty
    aegir ALL=NOPASSWD: /etc/init.d/nginx

    This gives Aegir – the aegir user – permission to restart nginx without requiring a sudo password.

    Test this works by doing the following:

    su – aegir
    sudo /etc/init.d/nginx restart

    What you want to see then is this:

    * Restarting nginx nginx
    [ OK ]

    Then:

    vim /etc/nginx/nginx.conf

    Comment out by putting a # in front of:

    # tcp_nopush on;
    # types_hash_max_size 2048;
    # error_log /var/log/nginx/error.log;

    Reboot, and use the one-time-link. You should be logged in fine and now can use Aegir!

  • Upload error 413 “Request Entity Too Large” on Nginx

    When trying to upload files to a Drupal installation running on nginx, we got a 413 error: Request Entity too large.

     

    We had gone through and updated the php files with regard to max upload file size limits, but had neglected to do the same to the nginx config file (/etc/nginx/nginx.conf on Debian). We had to add the following line:

    client_max_body_size 20M;

     

    in the http block and restart the nginx server to get uploads working again. The above will set the limit to 20MB; change it to suit your own environment and needs.

     

    You can also add this to the server or location blocks.

  • Drupal 7 – Two administrative menus after module installed

    In Drupal 7 when trying to use the module “Administration Menu” (quite a handy module) after enabling it we ended up with two menus or toolbars:

    Drupal 7 - Two menus or toolbars

    The fix for this is to disable the existing “Toolbar” module – this should remove the original toolbar and leave you with just the new Administration Menu menu/toolbar.

  • Drupal 7 – “Manage fields” missing from Content Type admin page

    When trying to add file uploads to the “page” content type creation, we found that the Manage Fields section was missing (Structure -> Content Types).

     

    In this case it turned out that the module Field UI had been disabled; re-enabling that module brought the Manage Fields option back.