function hook_photoswipe_js_options_alter in PhotoSwipe 3.x
Same name and namespace in other branches
- 8.2 photoswipe.api.php \hook_photoswipe_js_options_alter()
- 8 photoswipe.api.php \hook_photoswipe_js_options_alter()
Provides the ability to override Photoswipe settings passed to JS as Options.
Parameters
array $settings: Default Photoswipe settings array.
2 functions implement hook_photoswipe_js_options_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- photoswipe_assets_test_photoswipe_js_options_alter in tests/
modules/ photoswipe_assets_test/ photoswipe_assets_test.module - Implements hook_photoswipe_js_options_alter().
- photoswipe_test_theme_photoswipe_js_options_alter in tests/
themes/ photoswipe_test_theme/ photoswipe_test_theme.theme - Implements hook_photoswipe_js_options_alter().
1 invocation of hook_photoswipe_js_options_alter()
- PhotoswipeAssetsManager::attach in src/
PhotoswipeAssetsManager.php - Attach photoswipe assets.
File
- ./
photoswipe.api.php, line 14 - Hooks provided by the Photoswipe module.
Code
function hook_photoswipe_js_options_alter(array &$settings) {
// Disable sharing links.
$settings['shareEl'] = FALSE;
// Change or translate share buttons:
$settings['shareButtons'] = [
[
'id' => 'facebook',
'label' => t('Share on Facebook'),
'url' => 'https://www.facebook.com/sharer/sharer.php?u={{url}}',
],
[
'id' => 'twitter',
'label' => t('Tweet'),
'url' => 'https://twitter.com/intent/tweet?text={{text}}&url={{url}}',
],
[
'id' => 'pinterest',
'label' => t('Pin it'),
'url' => 'http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}',
],
[
'id' => 'download',
'label' => t('Download image'),
'url' => '{{raw_image_url}}',
'download' => TRUE,
],
];
}