0

I am using views_conditional module for Drupal 7 and would like to use a comma separated array (i think this is called an array?) of values in the "This value" textfield.

For example, I would like to add a views conditional field that checks for:

If this field... [type] == Content Type

Is... Contains

This value... Apples, (or) Oranges, (or) Bananas

As it is right now, (unless I am missing something) I would need to add 3 separate conditional field. One for each content type (apples, oranges, and bananas) though they are all executing the same function.

(I think) The current definition for the value field is:

$form['equalto'] = array(
  '#type' => 'textfield',
  '#title' => t('This value'),
  '#description' => t('Input a value to compare the field against.  Replacement variables may be used'),
  '#default_value' => $this->options['equalto'],
);

I also think the logic for the "Is..." operator in this use case would technically need to be something like "Contains Any".

(I think) The "Contains" function is defined here:

      // Contains
  case 7:
    if (mb_stripos($r, $equalto) !== FALSE) {
      return $then;
    }
    else {
      return $or;
    }
    break;

Is there a way to simply write a couple of hooks to alter the form, or would i need a full blown module patch?

Any help or pointers would be greatly appreciated! I am pretty new to backend code. I also posted a support request at Drupal.org

0

There is a patch for this for anyone else looking for a solution.

https://www.drupal.org/project/views_conditional/issues/2690167

| improve this answer | |

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.