diff --git a/modules/comment.eval.inc b/modules/comment.eval.inc new file mode 100644 index 0000000..468cad1 --- /dev/null +++ b/modules/comment.eval.inc @@ -0,0 +1,21 @@ +status == 1; +} + +/** + * @} + */ diff --git a/modules/comment.rules.inc b/modules/comment.rules.inc index 770be7e..313d09b 100644 --- a/modules/comment.rules.inc +++ b/modules/comment.rules.inc @@ -8,6 +8,13 @@ */ /** + * Implements hook_rules_file_info() on behalf of the comment module. + */ +function rules_comment_file_info() { + return array('modules/comment.eval'); +} + +/** * Implementation of hook_rules_event_info(). */ function rules_comment_event_info() { @@ -55,6 +62,51 @@ function rules_comment_event_info() { } /** + * Implements hook_rules_condition_info() on behalf of the comment module. + */ +function rules_comment_condition_info() { + $defaults = array( + 'parameter' => array( + 'node' => array('type' => 'comment', 'label' => t('Comment')), + ), + 'group' => t('Comment'), + 'access callback' => 'rules_comment_integration_access', + ); + $items['comment_is_published'] = $defaults + array( + 'label' => t('Comment is published'), + 'base' => 'rules_condition_comment_is_published', + ); + return $items; +} + +/** + * Implements hook_rules_action_info() on behalf of the comment module. + */ +function rules_comment_action_info() { + $defaults = array( + 'parameter' => array( + 'node' => array('type' => 'comment', 'label' => t('Comment'), 'save' => TRUE), + ), + 'group' => t('Comment'), + 'access callback' => 'rules_comment_admin_access', + ); + // Add support for hand-picked core actions. + $core_actions = comment_action_info(); + $actions = array( + 'comment_publish_action', + 'comment_unpublish_action', + ); + foreach ($actions as $base) { + $action_name = str_replace('_action', '', $base); + $items[$action_name] = $defaults + array( + 'label' => $core_actions[$base]['label'], + 'base' => $base, + ); + } + return $items; +} + +/** * Comment integration access callback. */ function rules_comment_integration_access($type, $name) { @@ -79,5 +131,12 @@ class RulesCommentEventHandler extends RulesEventHandlerEntityBundle { } /** + * Comment integration admin access callback. + */ +function rules_comment_admin_access() { + return user_access('administer comments'); +} + +/** * @} */