updated contrib modules

This commit is contained in:
Bachir Soussi Chiadmi
2018-01-24 13:37:38 +01:00
parent f9374cf96d
commit c57b3644fe
126 changed files with 6835 additions and 905 deletions
@@ -5,8 +5,8 @@ type: module
package: Field types
# core: '8.x'
# Information added by Drupal.org packaging script on 2017-10-23
version: '8.x-1.5'
# Information added by Drupal.org packaging script on 2017-12-27
version: '8.x-1.6'
core: '8.x'
project: 'audiofield'
datestamp: 1508783950
datestamp: 1514414887
@@ -78,7 +78,7 @@ function audiofield_theme($existing, $type, $theme, $path) {
}
/**
* Implements hook_theme_suggestions_HOOK().
* Implements hook_theme_suggestions_HOOK_alter().
*/
function audiofield_theme_suggestions_audioplayer_alter(array &$suggestions, array $variables) {
// Suggest a template using the plugin name.
@@ -0,0 +1,18 @@
{
"name": "drupal/audiofield",
"description": "AudioField Module",
"type": "drupal-module",
"license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/audiofield",
"minimum-stability": "dev",
"authors": [
{
"name": "Daniel Moberly",
"homepage": "https://www.drupal.org/u/danielmoberly",
"role": "Maintainer"
}
],
"support": {
"issues": "https://www.drupal.org/project/issues/audiofield"
}
}
@@ -41,6 +41,7 @@
wmode: 'window',
useStateClassSkin: true,
autoBlur: false,
preload: settings.lazyload,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: false,
@@ -78,6 +79,7 @@
wmode: 'window',
useStateClassSkin: true,
autoBlur: false,
preload: settings.lazyload,
smoothPlayBar: true,
keyEnabled: true,
volume: settings.volume,
@@ -125,6 +127,7 @@
},
swfPath: '/libraries/jplayer/dist/jplayer',
wmode: 'window',
preload: settings.lazyload,
keyEnabled: true,
supplied: file.filetype,
},
@@ -31,6 +31,7 @@
wmode: 'window',
useStateClassSkin: true,
autoBlur: false,
preload: settings.lazyload,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: false,
@@ -57,6 +58,7 @@
wmode: 'window',
useStateClassSkin: true,
autoBlur: false,
preload: settings.lazyload,
smoothPlayBar: true,
keyEnabled: true,
volume: settings.volume
@@ -88,6 +90,7 @@
swfPath: '/libraries/jplayer/dist/jplayer',
wmode: 'window',
keyEnabled: true,
preload: settings.lazyload,
supplied: file.filetype
});
});
@@ -108,4 +111,4 @@
});
}
};
})(jQuery, Drupal);
})(jQuery, Drupal);
@@ -64,6 +64,7 @@ class JPlayerAudioPlayer extends AudioFieldPluginBase {
'filetype' => $renderInfo->filetype,
'fid' => $renderInfo->id,
'autoplay' => $settings['audio_player_autoplay'],
'lazyload' => $settings['audio_player_lazyload'],
];
}
}
@@ -98,6 +99,7 @@ class JPlayerAudioPlayer extends AudioFieldPluginBase {
// JPlayer expects this as a 0 - 1 value.
'volume' => ($settings['audio_player_initial_volume'] / 10),
'autoplay' => $settings['audio_player_autoplay'],
'lazyload' => $settings['audio_player_lazyload'],
];
// Store the unique id for the template.
@@ -120,6 +122,7 @@ class JPlayerAudioPlayer extends AudioFieldPluginBase {
'files' => [],
'filetypes' => [],
'autoplay' => $settings['audio_player_autoplay'],
'lazyload' => $settings['audio_player_lazyload'],
];
// Format files for output.
@@ -7,7 +7,6 @@ use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Render\Markup;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -216,6 +215,33 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
],
],
];
// Settings for autoplay.
$elements['audio_player_lazyload'] = [
'#type' => 'checkbox',
'#title' => $this->t('Lazy Load audio'),
'#description' => $this->t("This setting causes audio not to be loaded until it is played."),
'#default_value' => $this->getSetting('audio_player_lazyload'),
'#states' => [
'visible' => [
[':input[name="fields[' . $fieldname . '][settings_edit_form][settings][audio_player]"]' => ['value' => 'audiojs_audio_player']],
[':input[name="fields[' . $fieldname . '][settings_edit_form][settings][audio_player]"]' => ['value' => 'default_mp3_player']],
[':input[name="fields[' . $fieldname . '][settings_edit_form][settings][audio_player]"]' => ['value' => 'jplayer_audio_player']],
[':input[name="fields[' . $fieldname . '][settings_edit_form][settings][audio_player]"]' => ['value' => 'mediaelement_audio_player']],
[':input[name="fields[' . $fieldname . '][settings_edit_form][settings][audio_player]"]' => ['value' => 'projekktor_audio_player']],
],
],
];
// Settings for download button.
$elements['download_button'] = [
'#type' => 'checkbox',
'#title' => $this->t('Display download button on player'),
'#default_value' => $this->getSetting('download_button'),
'#states' => [
'visible' => [
[':input[name="fields[' . $fieldname . '][settings_edit_form][settings][audio_player]"]' => ['value' => 'default_mp3_player']],
],
],
];
// Setting for optional download link.
$elements['download_link'] = [
'#type' => 'checkbox',
@@ -236,7 +262,9 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
// Show which player we are currently using for the field.
$summary = [
Markup::create('Selected player: <strong>' . $plugin_definitions[$settings['audio_player']]['title'] . '</strong>'),
$this->t('Selected player: <strong>@player</strong>', [
'@player' => $plugin_definitions[$settings['audio_player']]['title'],
]),
];
// If this is jPlayer, add those settings.
if ($settings['audio_player'] == 'jplayer_audio_player') {
@@ -254,16 +282,24 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
}
}
}
$summary[] = Markup::create('Skin: <strong>' . $theme . '</strong>');
$summary[] = $this->t('Skin: <strong>@theme</strong>', [
'@theme' => $theme,
]);
}
// If this is wavesurfer, add those settings.
elseif ($settings['audio_player'] == 'wavesurfer_audio_player') {
$summary[] = Markup::create('Combine files into single player? <strong>' . ($settings['audio_player_wavesurfer_combine_files'] ? 'Yes' : 'No') . '</strong>');
$summary[] = $this->t('Combine files into single player? <strong>@combine</strong>', [
'@combine' => ($settings['audio_player_wavesurfer_combine_files'] ? 'Yes' : 'No'),
]);
}
// If this is wordpress, add those settings.
elseif ($settings['audio_player'] == 'wordpress_audio_player') {
$summary[] = Markup::create('Combine files into single player? <strong>' . ($settings['audio_player_wordpress_combine_files'] ? 'Yes' : 'No') . '</strong>');
$summary[] = Markup::create('Animate player? <strong>' . ($settings['audio_player_wordpress_animation'] ? 'Yes' : 'No') . '</strong>');
$summary[] = $this->t('Combine files into single player? <strong>@combine</strong>', [
'@combine' => ($settings['audio_player_wordpress_combine_files'] ? 'Yes' : 'No'),
]);
$summary[] = $this->t('Animate player? <strong>@animate</strong>', [
'@animate' => ($settings['audio_player_wordpress_animation'] ? 'Yes' : 'No'),
]);
}
// If this is soundmanager, add those settings.
elseif ($settings['audio_player'] == 'soundmanager_audio_player') {
@@ -273,7 +309,9 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
'barui' => 'Bar UI',
'inlineplayer' => 'Inline Player',
];
$summary[] = Markup::create('Skin: <strong>' . $skins[$settings['audio_player_soundmanager_theme']] . '</strong>');
$summary[] = $this->t('Skin: <strong>@skin</strong>', [
'@skin' => $skins[$settings['audio_player_soundmanager_theme']],
]);
}
// Show combined settings for multiple players.
@@ -286,7 +324,9 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
'wordpress_audio_player',
])) {
// Display volume.
$summary[] = Markup::create('Initial volume: <strong>' . $settings['audio_player_initial_volume'] . ' out of 10</strong>');
$summary[] = $this->t('Initial volume: <strong>@volume out of 10</strong>', [
'@volume' => $settings['audio_player_initial_volume'],
]);
}
// Display autoplay.
@@ -299,17 +339,39 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
'wavesurfer_audio_player',
'wordpress_audio_player',
])) {
$summary[] = Markup::create('Autoplay: <strong>' . ($settings['audio_player_autoplay'] ? 'Yes' : 'No') . '</strong>');
$summary[] = $this->t('Autoplay: <strong>@autoplay</strong>', [
'@autoplay' => ($settings['audio_player_autoplay'] ? 'Yes' : 'No'),
]);
}
// Display lazy load.
if (in_array($settings['audio_player'], [
'audiojs_audio_player',
'default_mp3_player',
'jplayer_audio_player',
'mediaelement_audio_player',
'projekktor_audio_player',
])) {
$summary[] = $this->t('Lazy Load: <strong>@lazyload</strong>', [
'@lazyload' => ($settings['audio_player_lazyload'] ? 'Yes' : 'No'),
]);
}
// Check to make sure the library is installed.
$player = $this->audioPlayerManager->createInstance($settings['audio_player']);
if (!$player->checkInstalled()) {
$summary[] = Markup::create('<strong style="color:red;">' . t('Error: this player library is currently not installed. Please select another player or reinstall the library.') . '</strong>');
$summary[] = $this->t('<strong style="color:red;">Error: this player library is currently not installed. Please select another player or reinstall the library.</strong>');
}
// Show whether or not we are displaying download buttons.
$summary[] = $this->t('Display download button: <strong>@display_link</strong>', [
'@display_link' => ($settings['download_button'] ? 'Yes' : 'No'),
]);
// Show whether or not we are displaying direct downloads.
$summary[] = Markup::create('Display download link: <strong>' . ($settings['download_link'] ? 'Yes' : 'No') . '</strong>');
$summary[] = $this->t('Display download link: <strong>@display_link</strong>', [
'@display_link' => ($settings['download_link'] ? 'Yes' : 'No'),
]);
return $summary;
}
@@ -327,6 +389,8 @@ class AudioFieldFieldFormatter extends FormatterBase implements ContainerFactory
'audio_player_soundmanager_theme' => 'default',
'audio_player_initial_volume' => 8,
'audio_player_autoplay' => FALSE,
'audio_player_lazyload' => FALSE,
'download_button' => FALSE,
'download_link' => FALSE,
] + parent::defaultSettings();
}
@@ -15,7 +15,7 @@
<div class="audiofield">
<div id="{{ settings.id }}" class="audiofield-audiojs-frame">
<div class="audiofield-audiojs">
<audio preload="auto" {% if settings.audio_player_autoplay == 1 %} autoplay="autoplay" {% endif %}></audio>
<audio preload="{% if settings.audio_player_lazyload == 1 %}none{% else %}auto{% endif %}" {% if settings.audio_player_autoplay == 1 %} autoplay="autoplay" {% endif %}></audio>
<div class="play-pauseZ">
<p class="playZ"></p>
<p class="pauseZ"></p>
@@ -15,7 +15,7 @@
<div class="audiofield">
{% for file in files %}
<div class="mediaelementaudio_frame">
<audio id="mediaelement_player_{{ file.id }}" {% if settings.audio_player_autoplay == 1 %} autoplay="autoplay" {% endif %} controls>
<audio id="mediaelement_player_{{ file.id }}" preload="{% if settings.audio_player_lazyload == 1 %}none{% else %}auto{% endif %}" {% if settings.audio_player_autoplay == 1 %} autoplay="autoplay" {% endif %} controls>
<source src="{{ file.url }}">
Your browser does not support the audio element.
</audio>
@@ -14,7 +14,7 @@
#}
<div class="audiofield">
{% for file in files %}
<audio id="{{ file.id }}" class="audiofield-{{ plugin_id }} {{ plugin_id }}" controls>
<audio id="{{ file.id }}" preload="{% if settings.audio_player_lazyload == 1 %}none{% else %}auto{% endif %}" class="audiofield-{{ plugin_id }} {{ plugin_id }}" controls>
<source src="{{ file.url }}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
@@ -14,7 +14,7 @@
#}
<div class="audiofield">
{% for file in files %}
<audio controls {% if settings.audio_player_autoplay == 1 %} autoplay {% endif %}>
<audio preload="{% if settings.audio_player_lazyload == 1 %}none{% else %}auto{% endif %}" controls {% if settings.audio_player_autoplay == 1 %} autoplay {% endif %} {% if settings.download_button != 1 %} controlsList="nodownload" {% endif %}>
<source src="{{ file.url }}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>