function _audiofield_list_skins in AudioField 8
Helper function to list available skins.
3 calls to _audiofield_list_skins()
- AudioFieldFieldFormatter::settingsForm in src/
Plugin/ Field/ FieldFormatter/ AudioFieldFieldFormatter.php - Returns a form to configure settings for the formatter.
- AudioFieldFieldFormatter::settingsSummary in src/
Plugin/ Field/ FieldFormatter/ AudioFieldFieldFormatter.php - Returns a short summary for the current formatter settings.
- audiofield_library_info_build in ./
audiofield.module - Implements hook_library_info_build().
File
- ./
audiofield.module, line 41 - Drupal Module: Audiofield.
Code
function _audiofield_list_skins($player) {
$skins = [];
if (file_exists(DRUPAL_ROOT . '/libraries/jplayer') && $player == 'jplayer_audio_player') {
$files = \Drupal::service('file_system')
->scanDirectory(DRUPAL_ROOT . '/libraries/jplayer/dist/skin/', '#.*\\.min\\.css#');
foreach ($files as $file) {
// Generate a human readable name.
$name = preg_replace("/^(jplayer\\.)(.*)(\\.min)/", '$2', $file->name);
$skins[$name] = [
'library_name' => 'audiofield.jplayer.theme_' . preg_replace('#[^A-Za-z0-9]#', '', $name),
'name' => $name,
'path' => str_replace(DRUPAL_ROOT, '', $file->uri),
];
}
}
ksort($skins);
return $skins;
}