1

I tried to read a bit about what is actually a Variant in Drupal (and especially in Ctools).

But the 2-3 explanations I read were not clear enough for me. It was a wired experience for me since I've already learnt some "similar" Drupal unique terms such as Drupal argument, Contexual filter, Page (Drupal), Entity, Node, etc.

So what is a Variant and why do we need them? Please use the simplest explanation you can.

2

"Variants" are typically used / related to "Page Manager", which is part of the CTools module. The "simplest explanation***" is ... not "simple" to provide. However there is an interesting (amazing?) video intro about it: refer to Learn Page manager! Part 3: Variants and selection rules.

While you're at it, you may want to look at the entire (impressive) video series around there, i.e. Learn Page manager!. Here is a summary of the entire set of videos about this topic:

  • Page manager allows you to collect and manage contextual information in a flexible and consistent way. It is an important part of building infrastructure on Drupal websites, and you should know how to use this module.
  • The screencast series is targeted at experienced Drupal developers.
  • Episodes 1, 2 and 3 introduces the most basic concepts, such as custom pages, variants, selection rules and (to some extent) contextual objects.
  • Episodes 4, 5, 6 and 7 talk about Panels, with emphasis on Views integration but also some words on efficient caching.
  • Episodes 8 and 9 about access control, menu items, and not least the little-known but very useful Contextual Administration module.
  • Episodes 10 and 11 talks more about using contextual objects in Page manager, including using Views as context. This is, imho, where the real power in Page manager is.
  • Episodes 12 and 13 collects various bits and pieces, such as how to use Panels to easily rearrange the node edit form, import/export settings, and some extra modules that can be used with Page manager.

Some more recommended (free) tutorials that you may want to consider, and which will help a lot to understand the typical Drupal terminology in your question:

In Drupal 8, Page Manager has become a separated module, while formerly (up to Drupal 7), it was part of the CTools module. Here are some more quotes from the (D8 related) project page:

It supports the creation of new pages, and allows placing blocks within that page.

Like Drupal 7's Page Manager, it provides a concept of "page variants", each with their own selection conditions.

Additionally, it can be used to take over an existing page, like overriding /node/% to change what is displayed when viewing a node.

It utilizes the core Conditions, Context, and Blocks APIs to accomplish this.

So that's part of the changes coming up in the CTools module in D8.

1
  • I've heard something like this: In Drupal8 Ctools is going to change very much, some of the terms would be replaced (or something of the sort)... Have your also heard of such thing? – user16289 Aug 1 '15 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy