class VideoFilterCore in Video Filter 8
Core class for Video Fitler module.
Contains helper methods.
@package Drupal\video_filter
Hierarchy
- class \Drupal\video_filter\VideoFilterCore uses StringTranslationTrait
Expanded class hierarchy of VideoFilterCore
1 file declares its use of VideoFilterCore
- VideoFilterDialog.php in src/
Form/ VideoFilterDialog.php
File
- src/
VideoFilterCore.php, line 14
Namespace
Drupal\video_filterView source
class VideoFilterCore {
use StringTranslationTrait;
/**
* Load Video Filter plugins.
*/
public function loadPlugins($url = '') {
$result = [];
$manager = \Drupal::service('plugin.manager.video_filter');
$plugins = [];
foreach ($manager
->getDefinitions() as $plugin_info) {
$plugin = $manager
->createInstance($plugin_info['id']);
// Plugin options.
$options = $plugin
->options();
// Check if URL is supported.
$regexp = $plugin
->getRegexp();
$_regexp = !is_array($regexp) ? [
$regexp,
] : $regexp;
foreach ($_regexp as $regexp) {
if (preg_match($regexp, $url, $matches) && !empty($options)) {
$result['id'] = $plugin_info['id'];
$result['options'] = $options;
$result['plugin'] = $plugin;
}
}
$plugins[$plugin_info['id']] = [
'options' => $options,
'regexp' => $_regexp,
];
}
$result['plugins'] = $plugins;
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
VideoFilterCore:: |
public | function | Load Video Filter plugins. |