You are here

public function CitationStyler::setStyleById in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 src/CitationStyler.php \Drupal\bibcite\CitationStyler::setStyleById()

Load and set style by identifier.

Parameters

string $style_id: CSL style identifier.

Return value

\Drupal\bibcite\CitationStylerInterface The called Styler object.

Overrides CitationStylerInterface::setStyleById

1 call to CitationStyler::setStyleById()
CitationStyler::getStyle in src/CitationStyler.php
Get current CSL style.

File

src/CitationStyler.php, line 158

Class

CitationStyler
Render CSL data to bibliographic citation.

Namespace

Drupal\bibcite

Code

public function setStyleById($style_id) {
  $this->style = $this->cslStorage
    ->load($style_id);
  if (!$this->style) {
    throw new \UnexpectedValueException("CSL style '{$style_id}' does not exist.");
  }
  return $this;
}