You are here

public function DrupalOrg::getIndicator in Freelinking 8.3

Same name and namespace in other branches
  1. 4.0.x src/Plugin/freelinking/DrupalOrg.php \Drupal\freelinking\Plugin\freelinking\DrupalOrg::getIndicator()

A regular expression string to indicate what to replace for this plugin.

Return value

string A regular expression string.

Overrides External::getIndicator

File

src/Plugin/freelinking/DrupalOrg.php, line 32

Class

DrupalOrg
Freelinking drupal.org and drupal.org project plugin.

Namespace

Drupal\freelinking\Plugin\freelinking

Code

public function getIndicator() {
  $settings = $this
    ->getConfiguration()['settings'];
  if (!$settings['node'] && !$settings['project']) {
    return '/^NONE$/';
  }
  $pattern = '/^d(rupal)?(';
  if ($settings['node']) {
    $pattern .= 'o(rg)?';
    if ($settings['project']) {
      $pattern .= '|';
    }
  }
  if ($settings['project']) {
    $pattern .= 'p(roject)?)$/';
  }
  else {
    $pattern .= ')$/';
  }
  return $pattern;
}