You are here

public function ShortcodeService::getShortcodePluginTokens in Shortcode 8

Same name and namespace in other branches
  1. 2.0.x src/ShortcodeService.php \Drupal\shortcode\ShortcodeService::getShortcodePluginTokens()

Returns array of shortcode plugin definitions enabled for the filter.

Parameters

bool $reset: TRUE if the static cache should be reset. Defaults to FALSE.

Return value

array Array of shortcode plugin definitions.

1 call to ShortcodeService::getShortcodePluginTokens()
ShortcodeService::isValidShortcodeTag in src/ShortcodeService.php
Checking the given tag is valid ShortCode tag or not.

File

src/ShortcodeService.php, line 68

Class

ShortcodeService
Provide the ShortCode service.

Namespace

Drupal\shortcode

Code

public function getShortcodePluginTokens($reset = FALSE) {
  $shortcode_tokens =& drupal_static(__FUNCTION__);

  // Prime plugin cache.
  if (!isset($shortcode_tokens) || $reset) {
    $shortcodes = $this
      ->loadShortcodePlugins();
    $tokens = [];
    foreach ($shortcodes as $shortcode) {
      $tokens[$shortcode['token']] = $shortcode['token'];
    }
    $shortcode_tokens = $tokens;
  }
  return $shortcode_tokens;
}