You are here

protected function Wiki::getWikiFromIndicator in Freelinking 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/freelinking/Wiki.php \Drupal\freelinking\Plugin\freelinking\Wiki::getWikiFromIndicator()

Get the wiki name from the indicator string.

Parameters

string $indicator: The indicator string used.

Return value

string The full wiki name.

1 call to Wiki::getWikiFromIndicator()
Wiki::buildLink in src/Plugin/freelinking/Wiki.php
Build a link with the plugin.

File

src/Plugin/freelinking/Wiki.php, line 78

Class

Wiki
Freelinking wiki plugin implements wikipedia amongst other plugins.

Namespace

Drupal\freelinking\Plugin\freelinking

Code

protected function getWikiFromIndicator($indicator) {
  $ret = '';
  if (preg_match($this
    ->getIndicator(), $indicator, $matches)) {
    if (strlen($matches[0]) === 2) {
      $ret = $this->wikiMap[$matches[0]];
    }
    else {

      // The indicator is the full wiki name.
      $ret = $matches[0];
    }
  }
  return $ret;
}