FieldTypes, FieldWidgets and FieldFormatters


Drupal 8 ships with a big library on base classes which allow you to work with our very own content. When it comes to content entities you sure want to use the so called Fields. Well, the part of the entity where all your data goes is actually the fields, so you want to know about it.


Whenever you want to represent data in a non-Drupal way you might want to create a new field type for your data.

Add a FrameTargets

To add a target like _blank

1- Go to administration inside text format (admin/config/content/formats)
and choose the format you want to allow target.

2- Activate the filter HTML Purifier (advanced)

3- at bottom of option there is a tab to configure html purifier, the second option is AllowedFrameTargets
in that field add the target you want to allow in this case: _blank (check the picture attachment).

4- go bottom of the page and save change.

5- Delete cache

How to give constructive feedback

Start your post by thanking the contributor (be specific!) and identifying what was done correctly. Then, include specific critiques or corrections. Close your review by giving an actionable next step for the issue where appropriate.

Example of a supportive, constructive review:

Thanks @Druplicon! Looks like this test follows the steps to reproduce and the failure is exposed in the test-only patch.

Two suggestions:

HowTo: Enable group sign up during user registration

The Organic groups module (OG) comes with sub-module called Organic groups register that allows users to join an existing OG group when they first register to use the site. These instructions explain how to set this up.

Import content and its translations from CSV (managing entityreference field)

In this page, we will see how to handle an entityreference field in content type 2 referencing a content of content type 1 without having the id of the target, only its title.

And of course in all the languages we want.


For the main language import, we will be using an entityfieldquery to get the id of the content of content type 1 in the main language.
For the other languages import, we will use the main language import to be sure of the id of the target.

Import content and its translations from CSV

Using migrate-7.x-2.6-RC1.

The main purpose of this cookbook is to show how to import one content type in as many languages as you want using CSV import.

It assumes that you have one csv file per language, that each is in the csv format, and that the content for all its translations are at the same line.

Force using "" to avoid problem with language like russian chinese, japanese, arabic, etc...


Subscribe with RSS Subscribe to RSS - Needs copy/style review