public static function GeshiFilter::loadGeshi in GeSHi Filter for syntax highlighting 8
Same name and namespace in other branches
- 8.2 src/GeshiFilter.php \Drupal\geshifilter\GeshiFilter::loadGeshi()
Load geshi library.
If the geshi library is installed with composer, we use it, if not, we try to use it with libraries module(same way as drupal 7).
Return value
array Return an array with the same keys(the ones we use) from libraries_load().
7 calls to GeshiFilter::loadGeshi()
- GeshiFilter::getAvailableLanguages in src/
GeshiFilter.php - List of available languages.
- GeshiFilterCss::generateLanguagesCssRules in src/
GeshiFilterCss.php - Helper function for generating the CSS rules.
- GeshiFilterFilter::process in src/
Plugin/ Filter/ GeshiFilterFilter.php - Performs the filter processing.
- GeshiFilterLanguagesForm::buildForm in src/
Form/ GeshiFilterLanguagesForm.php - Form constructor.
- GeshiFilterProcess::geshiProcess in src/
GeshiFilterProcess.php - Geshifilter wrapper for GeSHi processing.
File
- src/
GeshiFilter.php, line 227
Class
- GeshiFilter
- Contains constantas and some helper functions.
Namespace
Drupal\geshifilterCode
public static function loadGeshi() {
$library = [];
// Try include geshi from composer.
if (class_exists('GeSHi')) {
$library['loaded'] = TRUE;
$library['library path'] = GESHI_ROOT;
}
elseif (\Drupal::moduleHandler()
->moduleExists('libraries')) {
$library = libraries_load('geshi');
}
else {
$library['loaded'] = FALSE;
$library['library path'] = '';
$library['error message'] = t('The GeSHi filter requires the GeSHi library (which needs to be @downloaded and installed seperately). Please review the install instruction at @readme.', [
'@downloaded' => \Drupal::l(t('downloaded'), Url::fromUri('http://qbnz.com/highlighter/')),
'@readme' => \Drupal::l(t('README.TXT'), Url::fromUri('http://cgit.drupalcode.org/geshifilter/tree/README.txt?h=8.x-1.x')),
]);
}
return $library;
}