diff --git a/assets/js/block-alpha.js b/assets/js/block-alpha.js index 709aa234c73645c78a693c753a0b620573c329cf..785a6f016cfac2c269c98a668777f36c134329cd 100644 --- a/assets/js/block-alpha.js +++ b/assets/js/block-alpha.js @@ -20,7 +20,7 @@ } else { $('#glossary-alpha-results').html('Please enter a search term.'); - return false; + return FALSE; } }); // End search box. diff --git a/assets/js/glossary-content-dialog.js b/assets/js/glossary-content-dialog.js index 7360c904d2957180386dc99c3f2aeb8dadc974b0..478b998ef908a73b905a29a79bc8508681412206 100644 --- a/assets/js/glossary-content-dialog.js +++ b/assets/js/glossary-content-dialog.js @@ -18,9 +18,9 @@ var termId = $(this).data('gterm'); var termText = $(this).text(); $('#glossary-dialog').dialog({ - autoOpen: true, - resizable: false, - modal: true, + autoOpen: TRUE, + resizable: FALSE, + modal: TRUE, close: function () { $('#glossary-dialog-inner').html('<div class="ajax-progress ajax-progress-throbber"><div class="ajax-throbber">' + Drupal.t('Loading...') + '</div></div>'); }, diff --git a/src/Controller/TermGlossaryController.php b/src/Controller/TermGlossaryController.php index 1cba3786a4172e7d6e4baaf7518657953f79da32..c91d5581b53b0005cfc9184e6209ad17743a3d36 100644 --- a/src/Controller/TermGlossaryController.php +++ b/src/Controller/TermGlossaryController.php @@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\RequestStack; use Drupal\Component\Utility\Html; /** - * Class TermGlossaryController. + * Class of TermGlossaryController. */ class TermGlossaryController extends ControllerBase { diff --git a/src/Form/TermGlossaryConfigForm.php b/src/Form/TermGlossaryConfigForm.php index 92d97b7ef0cdf1368972420705ec3b438cd410ab..2a9ba38f0551bdd6744860f703ca5882ddf044f6 100644 --- a/src/Form/TermGlossaryConfigForm.php +++ b/src/Form/TermGlossaryConfigForm.php @@ -10,7 +10,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; /** - * Class TermGlossaryConfigForm. + * Class of TermGlossaryConfigForm. */ class TermGlossaryConfigForm extends ConfigFormBase { @@ -22,7 +22,9 @@ class TermGlossaryConfigForm extends ConfigFormBase { protected EntityTypeManagerInterface $entityTypeManager; /** - * @var \Drupal\Core\Entity\EntityFieldManagerInterface + * Summary of entityFieldManager. + * + * @var Drupal\Core\Entity\EntityFieldManagerInterface */ protected EntityFieldManagerInterface $entityFieldManager; diff --git a/src/Service/TermGlossaryManager.php b/src/Service/TermGlossaryManager.php index 8fe05d90e60f6777c0eb78c25e6fe9dd7393f782..af870cc454440ba1b4b2ff3657cf0c8ae23b31cf 100644 --- a/src/Service/TermGlossaryManager.php +++ b/src/Service/TermGlossaryManager.php @@ -8,37 +8,67 @@ use Drupal\Core\Config\ImmutableConfig; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; +/** + * Summary of TermGlossaryManager. + */ class TermGlossaryManager { /** - * @var \Drupal\Core\Config\ConfigManagerInterface + * Summary of configManager. + * + * @var Drupal\Core\Config\ConfigManagerInterface */ protected ConfigManagerInterface $configManager; /** - * @var \Drupal\Core\Entity\EntityTypeManagerInterface + * Summary of entityTypeManager. + * + * @var Drupal\Core\Entity\EntityTypeManagerInterface */ protected EntityTypeManagerInterface $entityTypeManager; /** - * @var \Drupal\Core\Entity\EntityStorageInterface + * Summary of termStorage. + * + * @var Drupal\Core\Entity\EntityStorageInterface */ protected EntityStorageInterface $termStorage; /** - * @var \Drupal\Core\Cache\CacheBackendInterface + * Summary of cache. + * + * @var Drupal\Core\Cache\CacheBackendInterface */ protected CacheBackendInterface $cache; /** - * @var \Drupal\Core\Config\ImmutableConfig + * Summary of config. + * + * @var Drupal\Core\Config\ImmutableConfig */ protected ImmutableConfig $config; - + /** + * {@inheritdoc} + */ protected string $cacheId = 'glossary_terms_array'; - + /** + * {@inheritdoc} + */ protected array $termList; + /** + * Summary of __construct. + * + * @param \Drupal\Core\Config\ConfigManagerInterface $configManager + * + * The configManager. + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager + * + * The entityTypeManager. + * @param \Drupal\Core\Cache\CacheBackendInterface $cache + * + * The cache. + */ public function __construct(ConfigManagerInterface $configManager, EntityTypeManagerInterface $entityTypeManager, CacheBackendInterface $cache) { $this->configManager = $configManager; $this->entityTypeManager = $entityTypeManager; @@ -48,11 +78,15 @@ class TermGlossaryManager { } /** - * @param $text - * Original string. + * Summary of replaceFieldValue. * - * @return string - * String with highlighted terms. + * @param mixed $text + * The text. + * @param mixed $vocabulary + * The vocabulary. + * + * @return mixed + * It will return mixed. */ public function replaceFieldValue($text, $vocabulary = NULL) { $this->termList = $vocabulary ? $this->getTerms($vocabulary) : $this->termList = $this->getTerms(); @@ -64,7 +98,7 @@ class TermGlossaryManager { preg_match_all("/$name+/i", $new_value, $matches); if (is_array($matches[0]) && count($matches[0]) >= 1) { foreach ($matches[0] as $match) { - $new_value = str_replace($match, '<span class="glos-term" data-gterm="' . $term_id . '">'.$match.'</span>', $new_value); + $new_value = str_replace($match, '<span class="glos-term" data-gterm="' . $term_id . '">' . $match . '</span>', $new_value); } } } @@ -118,13 +152,14 @@ class TermGlossaryManager { } /** - * Update term list. + * Summary of updateTermList. * - * @param $vocab - * Glossary vocabulary id. + * @param mixed $vocab * - * @return array - * Glossary term list + * The vocab. + * + * @return arrayarray + * It will return array. */ private function updateTermList($vocab) { $terms = $this->termStorage->loadByProperties(['vid' => $vocab]); @@ -143,4 +178,5 @@ class TermGlossaryManager { $this->cache->set($cacheId, $terms_array, CacheBackendInterface::CACHE_PERMANENT, []); return $terms_array; } + }