I'm trying to add menu items programatically by using rules - the item should be added after user will create a term, but I need a specific condition that I cannot accomplish - fire rule only if ONE OF THE ANCESTORS of created term is specific term. So for example if I have hierarchy:

Term 1
Term 2
 - Term 2.1
 - Term 2.2
   -Term 2.2.1

I would like the rule to fire when the added term is 2.x.x.x... How can I accomplish this? I was trying for few hours different approaches without luck.


Write your own condition for rules

function mymodule_rules_condition_info() {
  return array(
    'mymodule_condition_needs_veryfication' => array(
      'label' => t('ONE OF THE ANCESTORS of created term is specific term'),
      'group' => t('mymodule'),
      'arguments' => array(
        'aplication_node' => array(
            'type' => 'node',
            'label' => t('A fancy condition'),
      'module' => 'mymodule',
function mymodule_condition_needs_veryfication($node) 
    return true;
  return false;

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.