0

Need to create a custom Rules Action. How do I pragmatically get the node ID for an action such as when a node is saved?

1 Answer 1

1

You can pass parameter node then you will get full node object into your action.

function MODULEname_rules_action_info() {
  return array(
    'CALLBACK_FUNCTION_NAME' => array(
      'label' => t('Send Mail to users for new content'),
      'parameter' => array(
        'node' => array('type' => 'node', 'label' => t('Current Node')),
      ),
      'group' => t('MODULE'),
    ),
  );
}
4
  • Is this accurate? I've tried it and I don't automatically get the node id.
    – icicleking
    Apr 20, 2018 at 18:00
  • Can you share your code so that I can understand it. Apr 21, 2018 at 8:30
  • Please accept it as answer. Apr 24, 2018 at 17:44
  • Sorry, it's not my question ¯_(ツ)_/¯
    – icicleking
    Apr 25, 2018 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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