? .svn
? custom_links.rules.inc
? custom_links_rules_integration-696302.patch
Index: custom_links.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/custom_links/custom_links.admin.inc,v
retrieving revision 1.1
diff -u -p -r1.1 custom_links.admin.inc
--- custom_links.admin.inc	27 Jan 2008 09:16:01 -0000	1.1
+++ custom_links.admin.inc	29 Jan 2010 21:33:25 -0000
@@ -110,7 +110,14 @@ function custom_links_form() {
     '#type' => 'fieldset',
     '#title' => t('Link conditions'),
   );
-
+  if (module_exists('rules')) {
+    $form['filters']['use_rules'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Limit Visibility with Rules'),
+      '#default_value' => $lid ? $link->use_rules : FALSE,
+      '#description' => t('Use the rules module in additon to any settings below to limit visibility. You must use the "Set Link Visibility" action. Links are assumed visible until visibility is set to 0 (FALSE).'),
+    );
+  }
   $modes = array(
     0 => t('In full node views'),
     1 => t('In teaser node views'),
Index: custom_links.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/custom_links/custom_links.install,v
retrieving revision 1.2
diff -u -p -r1.2 custom_links.install
--- custom_links.install	27 Jan 2008 09:16:01 -0000	1.2
+++ custom_links.install	29 Jan 2010 21:33:26 -0000
@@ -87,6 +87,13 @@ function custom_links_schema() {
         'default' => 'AND',
         'description' => t("An optional anchor fragment to be appended to the URL path."),
       ),
+      'use_rules' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'size' => 'small',
+        'default' => 0,
+        'description' => t('A boolean flag indicating whether rules should be used to set link visibility.'),
+      ),
     ),
     'primary key' => array('lid'),
   );
@@ -109,6 +116,20 @@ function custom_links_update_1() {
   return $ret;
 }
 
+function custom_links_update_2() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("ALTER TABLE {custom_link} ADD use_rules int");
+      break;
+    case 'pgsql':
+      db_add_column($ret, 'custom_link', 'use_rules', 'int', array('default' => '0'));
+      break;
+  }
+  return $ret;
+}
+
 function custom_links_uninstall() {
   drupal_uninstall_schema('custom_links');
 }
Index: custom_links.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/custom_links/custom_links.module,v
retrieving revision 1.5
diff -u -p -r1.5 custom_links.module
--- custom_links.module	27 Jan 2008 09:16:01 -0000	1.5
+++ custom_links.module	29 Jan 2010 21:33:26 -0000
@@ -83,6 +83,20 @@ function _custom_links_build_links($node
   $custom_links = _custom_links_load_all_links();
 
   foreach ($custom_links as $link) {
+    if ($link->use_rules && module_exists('rules')) {
+      global $user;
+      rules_invoke_event('custom_links_build', array(
+        'link' => &$link,
+        'node' => $node,
+        'global_user' => $user,
+        'author' => user_load($node->uid),
+        'teaser' => $teaser,
+        'block' => $block,
+      ));
+      if (isset($link->visible) && $link->visible === FALSE) {
+        continue;
+      }
+    }
     if (($block && $link->display != 3) || (!$block && $link->display == 3)) {
       continue;
     }
