fixe sound direct link with mobile from desktop, fix #584

This commit is contained in:
2020-04-29 13:01:16 +02:00
parent 2eb05babe5
commit 67271fc277
8 changed files with 520 additions and 468 deletions
@@ -13,13 +13,13 @@ use Drupal\Core\Url;
* @param array $attachments
*/
function edlp_ajax_page_attachments(array &$attachments) {
// provied info about available urls needed for ajax purpose
$url = Url::fromRoute('edlp_ajax.entityjson');
$attachments['#attached']['drupalSettings']['edlp_ajax']['entityjson_path'] = $url->getInternalPath();
$url = Url::fromRoute('edlp_ajax.blocksjson');
$attachments['#attached']['drupalSettings']['edlp_ajax']['blocksjson_path'] = $url->getInternalPath();
$redirect = false;
// provied infos about current entity (node or taxonomy term) and audio files
$current_path = \Drupal::service('path.current')->getPath();
$current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
$is_front = \Drupal::service('path.matcher')->isFrontPage();
@@ -49,6 +49,7 @@ function edlp_ajax_page_attachments(array &$attachments) {
// do not redirect if not node, term, or custom routing
// FIXME: check with routes instead of path as path can change !!!
$redirect = false;
if(preg_match('/^\/?node\/\d+/', $current_path)
|| preg_match('/^\/?taxonomy\/term\/\d+/', $current_path)
|| preg_match('/^\/?productions/', $current_path)