We use another module, Pathologic, that provides the same functionality as Path Filter, but cannot use the Linkit module (without modifying the .info file) due to dependency on Path Filter.

One option would be to use some logic in the module's info file to require Path Filter OR Pathologic, but I could not find any information on Drupal.org about how to do this, if it's even possibly. If there is no option to do this, would you consider removing the Path Filter dependency and just adding some documentation stating that Path Filter or Pathologic is required?

Nice looking module, I'm investigating it as an alternative to Node Picker.

Comments

anon’s picture

I will see what I can do with hook_requirements

anon’s picture

Assigned: Unassigned » anon

I think I have a solution for this, but how should we inform the users that this module have dependencies before they try to install it?

The "dependencies" in the .info file is very good at this point.

Any ideas?

anon’s picture

Status: Active » Fixed

Commited.

timwood’s picture

Wow, thanks for fixing this so fast! Sorry I wasn't at a computer this weekend to respond. As for notifying the users of the dependency, were you able to come up with something, or did you figure out how to have a conditional dependency? I've seen other modules that provide a message on screen, either in web interface, or plain text if you enable the module with Drush, that directs the user to do something. Maybe this would be a good place for a notification?

anon’s picture

This is how I solved it.

/**
 * Implementation of hook_requirements().
 */
function linkit_requirements($phase) {
  $requirements = array();
  $t = get_t();

  switch ($phase) {
  case 'runtime':
    break;
  case 'install':
    if(!module_exists('pathfilter') && !module_exists('pathologic')) {
      $requirements['linkit_dependencies'] = array(
        'title' => $t('Linkit'),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('The Linkit module requires <a href="@pathfilter">pathfilter</a> <strong>OR</strong> <a href="@pathologic">pathologic</a>, be sure you have <strong>ONE</strong> of this modules installed.', array(
          '@pathfilter' => 'http://drupal.org/project/pathfilter',
          '@pathologic' => 'http://drupal.org/project/pathologic'
        )),
      );
    }
    break;
  }
  return $requirements;
}

What do you think about this?

timwood’s picture

I'm no coder, but I think this accomplishes what I suggested in comment #4. Thanks! I can't wait for the next version to be released.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.