Delete field when module is uninstalled

Hello All,

I have added a field in the user section using yml file which is added in "config/install" location in my custom module.
I want to delete this field when ever the module is uninstalled, could not find appropriate code to do this.

Can someone please point me in the right direction.

--
Best
Prashanth

Entityreference subfields for Migrate

After the #1676646: make migrate field handler behave the same way as term reference: accept entity labels, allow creation of entities patch will be committed, there'll be available three new sub-fields for Entityreference field:

  • source_type: If the option is set to 'name', there would be used text label of an entity, rather than its ID in the source column.
  • create_entity: If the option is set to TRUE (or any other value different from FALSE/0), and the source_type is set to 'name', then if no entity was found for the given label, it will be created automatically.
  • ignore_case: If this option is TRUE, then case differences (uppercase vs. lowercase) between source data and existing entity names will be ignored. The default behavior is to not ignore case.

Recovering the administrator password from UI

There are many methods to recover admin password described here https://www.drupal.org/node/44164 but this method gives you a admin panel to recover admin username and password.

This gives easy access and UI to generate admin password. This will let you know what is the current admin username in system.

Recovering the administrator password from UI

Manage Breadcrumbs In Your Module

Overview

In this tutorial we will go through how to set breadcrumbs in your Drupal 8 module. In Drupal 7 we were using drupal_set_breadcrumb(). In Drupal 8 drupal_set_breadcrumb() is removed and breadcrumbs are managed using the Breadcrumb service. There are only a few steps to do this:

  • Declare your service
  • Define a class implementing BreadcrumbBuilderInterface

This tutorial assumes that you have a working Drupal 8 module.

How to programmatically add a product variation to the cart in Drupal commerce 2.x (Drupal 8)

Playing a bit with Drupal commerce in Drupal 8, we notice that several functions that we used to use in the past with D7 are gone in D8, or they've had several changes, dued to the new API.

Drupal commerce has lots of changes. The new concept give us more flexibility and features (for example, we don't need a content type to display our products, because they have now their own display page, the product variations are now in commerce core, or the Store concept.).

An user pays credits for publishing a post

Paying credits for doing actions on a site makes it necessary to check user credits before performing the action. So I use an "Before saving content" event and a "Entity has credits" action to do so.

To avoid publishing the post we send the user back to the add content form using a custom "Execute custom PHP code" action. In order to allow PHP snippets you have to activate core module "PHP filter".

The first rule looks like that:

Pages

Subscribe with RSS Subscribe to RSS - Intermediate