David Valdez's blog

Creating a New Social Simple Button

Sharing an article via a social network is a super common task requested on a project.

Fortunately for Drupal 8 there is a module for that called Social Simple. This module allows you to display the most popular networks in a node so the user can just click any of the buttons and share the article.

By default this module provides the following buttons:

Change the text field maximum length in Drupal 8

Once a text field has data stored, it is not very easy or obvious how to change its maximum length. In the UI there is a message warning you that the field cannot be changed, because there is existing data. Sometimes it is necessary to change these values. It seems that there are a few ways and some resources to do this in Drupal 7, but I could not find a way to do this in Drupal 8. I decided to create a small function to do it:

Display forms in a modal dialog with Drupal 8

Drupal 8 has a great AJAX form API which includes some tools to create modal dialogs using the jQuery modal library. The Examples module even demonstrates how to create a custom form and display it in a modal window. But what if what you want to do is display an already created form in a modal? How do we do that? Let's see how to do it with an example. Let's display the node add form in a modal window.

Using CKEditor plugins in Drupal 8

CKEditor is well-known software with a big community behind it and it already has a ton of useful plugins ready to be used. It is the first and only WYSIWYG text editor to ship with Drupal 8 core. Unfortunately, the many plugins provided by the CKEditor community can't be used directly in the CKEditor that comes with Drupal 8. It is necessary to let Drupal know that we are going to add a new button to the CKEditor.