Drupal 8: Entity Embed Module

Entity Embed is a module created for Drupal 8 by Chandan Singh for his Google Summer of Code 2014 project. It allows you to embed any type of entity such as Content, Comment, and Role. This blog post was made for Google Code-In 2014 to test and review Entity Embed.

Installation

The module was easily cloned into /modules/contrib/ from the GitHub Repository. From there, the module was activated. An error occurred while installing, which resulted in a blank white screen. Although, I was notified by Chandan Singh that this is a known error, and in spite of the error, the module should work fine. After a refresh, the module seemed to be installed, and no error was seen. The install process was easy, however the error might worry a user.

Configuration

Configuring the module was fairly straightforward. An Embed Button needs to be created for each entity type wished to be used in CKEditor. Once the buttons have been created, they can be added to the CKEditor interface in “Text formats and editors”.

entity-embed-ckeditor-config

As it is right now, it is beneficial for those who will use this module to embed only certain entity types since there is one button for a single entity type, however for people who want to embed many entity types it will be difficult to distinguish between the buttons since they all have the same icon. Although an icon/image can be uploaded for the buttons, they might not know how to make the icons.

Usage

Using Entity Embed in CKEditor while creating a new article or page was very simple. After clicking the “E” button, typing in the title of the entity, and configuring, the entity could be seen in the WYSIWYG editor.

Entity Embed Edit Content

One improvement for user interface is to keep the title in the box and load the ID/UUID in the background instead of showing the ID/UUID in the textbox. Also, some “Display as:” values show the same content in the editor. For example, both “Author” and “Label” show the title of the entity. Issue Reported Here. “Display as:” problem relates to another module.

Entity Embed Embedded First Post

Conclusion

Overall, Entity Embed is a great plugin! It can easily be used to embed any type of entity into the WYSIWYG CKEditor in Drupal 8. With some improvements here and there Entity Embed can be perfected!

Drupal 8: Setting Up Multi-site

There is an incredibly easy way to create multiple Drupal sites. You don’t need to duplicate the code. You can have multiple sites, with different content, users, and themes since each site can use a different database. They will all run on a single codebase and will be able to share modules. This is one of Drupal’s greatest features called Multi-site. It was first implemented in Drupal 4, and it is here now in Drupal 8.

Getting Prepared

To get started, go ahead and download Drupal.

Then, upload and extract all the files into a new folder for Drupal. For example: /public_html/drupal/

I will be creating two sites, one for dogs, and the other for cats.

These multiple sites can be accessed either from subdomains or subdirectories. If you are going to use subdomains, go ahead and create them. However, if you are going to use subdirectories, hold off until later, since you will have to remove it anyways.

I want the dogs website to be accessed by a subdomain and the cats website by a subdriectory, so I will create dogs.kalose.net

Now create a separate database for each site. Also, create a user or two to access these databases.

I will name my databases user_dogs and user_cats which will be accessed by user user_drupal who will have privileges: ALTER, CREATE, CREATE TEMPORARY TABLES, DELETE, DROP, INDEX, INSERT, SELECT, AND UPDATE.

The Technical Part

Coding

Navigate into the directory: /drupal/sites/

We need to tell Drupal we are going to have multiple sites. To do this, create a file called sites.php.

This file will contain an $sites array containing all the rules. For each index, the key will be the formatted address the website will be accessed at, and the value will be what folder to look in.

Format of each index:

'<port>.<domain>.<path>' => 'directory'.

My sites.php:

Since we said dogs.kalose.net was going to use the /dogs/ folder and www.kalose.net/cats/ was going to use the /cats/ folder, these folders need to be created: /drupal/sites/dogs/ and /drupal/sites/cats/

SSH / Shell / Terminal

Connect to your webserver via SSH. If you’re on Windows, you can use PuTTY.

The /drupal/sites/default/ site will have default files we need to copy into each of our sites. Copy these files using the cp command in the sites directory:

Now we have successfully set up Drupal for multi-site. Although, if you visit dogs.kalose.net or www.kalose.net/cats/ it will be blank. Why? How does the web server know to point these sites to the /drupal/ directory? This is why we need to make symbolic links from /dogs/ and /cats/ to /drupal/

If a subdirectory is created when you create a subdomain, delete that directory.

Now time to create the symbolic links. This is why we did’t have to create the /cats/ subdirectory. The symbolic link will automatically point /dogs/ and /cats/ to /drupal/ like they are the same folder.

* You may notice that these folders/links have all permissions (chmod 777). You don’t need to worry about this because these permissions won’t be used, instead the permissions of /drupal/ or the file/folder you are linking to will be used.

Finishing Up

All that is left to do now is to install Drupal. I can visit dogs.kalose.net and www.kalose.net/cats/ and set them up using databases user_dogs and user_cats. Using Multi-site, these sites can be completely different except for the fact that they share the same underlying code.

Drupal: Using SimplyTest.Me

SimplyTest.Me is an easy tool, made by Patrick Drotleff, you can use to “Simply Test” any Drupal Distribution, Module, or Theme. As you may know it takes several minutes to set up a local Drupal installation, you may even encounter problems. Instead, you can use SimplyTest.Me which has many benefits over setting up a local install of Drupal for testing purposes:

  1. Speed: All it takes is a few clicks here and there, and you will have your Drupal install ready in less than 2 minutes.
  2. Experimenting: You can quickly try out any distribution, module, or theme to see if you actually want to use it in your main Drupal installation.
  3. Reliability: If your local web development server is having issues, no worries, SimplyTest.Me will be available online to use at any time.
  4. Mobility: Not at your local development machine? You can test Drupal on just about every computer with internet access.
  5. Testing: Under the Advanced Options, you can link to a patch. This patch will automatically be applied to the Drupal install. This makes it much easier to review patches.

 

Note: All Drupal sandboxes are temporary and will have a time limit of 30 minutes.

This blog post was created with a video, for GCI, to explain the benefits of using SimplyTest.Me over a local install of Drupal.

Create A Spinning Gif Image in Adobe Photoshop

Did you know you can use the new timeline feature to easily create spinning .gif images? This is pretty useful for AJAX loaders, and here is a simple way to create it.

What We Will Be Creating

Spinning-Gif

Continue reading

Welcome to My New Website

I decided to stop the Akshay Productions website, thus I have created this site. I will be posting new posts, software, everything else here from now on.

Technology Tips, Tricks, Tutorials and more!