About me

My name is Kirill Roskoliy.
I'm a Drupal developer.
I started to work with Drupal in 2008.
Currently I'm working on Trellon, LLC and maintaining CRM Core — Drupal-based framework to build CRM solutions.

Exporting Drupal Commerce products with Featues

While the products in general is a content entity like a node there could be situations when you will want to store some products in features because they become a configuration entity.

For this we will need:

  1. Universally Unique IDentifier
  2. UUID Features Integration
  3. Commerce UUID

Install this modules as usual.

Now some configuration needed:

  1. Assign UUIDs to all supported entities by visiting admin/config/system/uuid and clicking "Create missing UUIDs"
  2. Select product types that may be exported here admin/structure/features/uuid_features

That's all! Now you are ready to export your products to feature.

Code syntax highlighting in Drupal

There is a great article about the syntax highlighting in Drupal configuration by the DrupalOnWindows.com and I just want to make an addition to it.

Following steps described in it I wasn't able to see CodeSnippet button in CKEditor layout configuration for some reasons, it feels like there is a bug causing this in CKEditor module. I've discovered that using this plugin is possible with ease by using CDN version of CKEditor. Put the following


in the "Path to CKEditor" in "CKEditor Global profile" settings and the you will be able to enable CodeSnippet plugin for the CKEditor profile of your choice and put CodeSnippet plugin button in layout configuration.

Entity API new helper method

With new release(v1.6) of Entity API module we received not only a security fix but a small but very helpful method of an Entity class.

Before this release when you want to get an entity wrapper you have to do something like this:

// Each function needing it creates a new EntityMetadataWrapper class.
$wrapper = entity_metadata_wrapper($entity->entityType(), $entity);

With this new method:

// Uses always the same EntityMetadataWrapper class because it is stored in the Entity itself.
$wrapper = $entity->wrapper();

As you can see it's a really small change, but still it's very useful!

Permissions doesn't get saved

Today I faced with interesting issue when working on one of projects - saving new permissions doesn't work, the page just get reloaded without any message on a page or in the watchdog, and off course nothing is changed on permissions page. I've found the workaround for this issue, but decided to discuss with colleagues and M. Priest told that already saw likely issue and we need to check value of max_input_vars PHP directive.
The root cause here is that when you have a lot user roles configured in Drupal(we had 17 in this project and I know this is not good, but at the point we faced with this issue we didn't fixed extra roles issue yet) and you have configured an admin role(which is general the case) you will receive around 500 values only for admin role and then plus permissions for each other role. The resulting amount of variables could be more then 1000 which is the default value of max_input_vars. So increasing this number to something like 2000 will fix the issue with saving permissions configuration.