You are here

public function AlinkPostRenderer::__construct in Alinks 8

AlinkPostRenderer constructor.

Parameters

\Drupal\Core\Render\Markup $content: The content of the current page.

array $context: The current page context.

null $xpathSelector: The selector rule for the html.

File

src/AlinkPostRenderer.php, line 43

Class

AlinkPostRenderer
Class AlinkPostRenderer.

Namespace

Drupal\alinks

Code

public function __construct($content, $context = NULL, $xpathSelector = NULL) {
  if (!empty($context['#entity_type']) && !empty($context['#' . $context['#entity_type']])) {
    $entity = $context['#' . $context['#entity_type']];
    $class = 'Wamania\\Snowball\\' . $entity
      ->language()
      ->getName();
    if (class_exists($class)) {
      $this->stemmer = new $class();
    }
    else {
      $this->stemmer = new English();
    }
  }
  $this->content = $content;
  if ($xpathSelector) {
    $this->xpathSelector = $xpathSelector;
  }
}