27

When creating a new contextual filter for a view the list of types includes options such as content:spec (field_spec:delta) where spec is the name of a field I have attached to the content type accepted for the view. It appears on some, but not all of the fields offered in the list. I cannot find a reference on this field. What is this (field_name:delta)?

30

It appears only for multi-value fields. It refers to the order of the values. A delta of 0 is usually the first item, 1 is the second, etc. This can be used to restrict results to ones that have values for a specific delta.

  • 2
    I found this really helps to reduce duplicates without using the distinct flag (which doesn't always work anyway). I have an exposed filter that can also reduce duplicates but if the filter is empty multiple results do present without delta == 0 in the filters. – danielson317 Jun 28 '16 at 15:20
6

In Drupal, delta variable name inherits the Drupal 6 terminology and is an index for fields, blocks etc of the same type.

In module developement $delta allows one module to return many blocks. It may also be easier to understand if you keep in mind that the $delta need not be numeric. It's simply an identifier.

In your case is a local identifier of that field. It is similar to #id in CSS.

  • Thanks, I was looking for the delta in the UI, but will be meeting your variable soon as I get involved with the php end of Drupal. – Ashlar Oct 24 '11 at 14:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.