Skip to content

Commit 315f429

Browse files
Issue #3501085 by richardgaunt, fionamorrison23, nidhish, joshua1234511: images with 'image style' should have relative link (#1404)
1 parent 53bcfac commit 315f429

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

web/themes/contrib/civictheme/config/install/editor.editor.civictheme_rich_text.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ settings:
7676
- '<figure class data-component-id>'
7777
- '<div class>'
7878
- '<iframe width height src title allowfullscreen>'
79+
- '<video controls class width height>'
80+
- '<source src type>'
81+
- '<a hreflang target title data-dialog-type data-dialog-options class="ct-content-link ct-content-link--external use-ajax ct-button--button ct-button--prompt ct-button--link ct-promo__button ct-theme-dark">'
82+
- '<table class="ct-theme-dark">'
7983
ckeditor5_style:
8084
styles:
8185
-

web/themes/contrib/civictheme/config/install/filter.format.civictheme_rich_text.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ filters:
4141
status: true
4242
weight: -50
4343
settings:
44-
allowed_html: '<br> <p class="ct-text-large ct-text-small text-align-left text-align-center text-align-right"> <h2 id class> <h3 id class="text-align-left text-align-center text-align-right"> <h4 id class="text-align-left text-align-center text-align-right"> <h5 id class="text-align-left text-align-center text-align-right"> <h6 id class="text-align-left text-align-center text-align-right"> <a class="ct-button ct-theme-light ct-button--primary ct-button--regular ct-button--secondary ct-button--large ct-content-link ct-content-link--external ct-button--button ct-theme-dark" hreflang target title href data-entity-type data-entity-uuid data-entity-substitution> <table class="ct-theme-light ct-table ct-table--striped"> <cite> <dl> <dt> <dd> <img src alt data-entity-type data-entity-uuid> <drupal-entity alt title data-entity-type data-entity-uuid data-entity-embed-display data-entity-embed-display-settings data-align data-caption data-embed-button> <span class="ct-visually-hidden"> <svg role viewbox aria-hidden width height class="ct-icon"> <path d> <blockquote cite> <ul type> <ol type start> <drupal-media title data-entity-type data-entity-uuid alt data-caption data-align> <figure class data-component-id> <div class> <iframe width height src title allowfullscreen> <strong> <em> <u> <s> <sub> <sup> <li> <tr> <td rowspan colspan> <th rowspan colspan> <thead> <tbody> <tfoot> <caption>'
44+
allowed_html: '<br> <p class="ct-text-large ct-text-small text-align-left text-align-center text-align-right"> <h2 id class> <h3 id class="text-align-left text-align-center text-align-right"> <h4 id class="text-align-left text-align-center text-align-right"> <h5 id class="text-align-left text-align-center text-align-right"> <h6 id class="text-align-left text-align-center text-align-right"> <a class="ct-button ct-theme-light ct-button--primary ct-button--regular ct-button--secondary ct-button--large ct-content-link ct-content-link--external use-ajax ct-button--button ct-button--prompt ct-button--link ct-promo__button ct-theme-dark" href data-entity-type data-entity-uuid data-entity-substitution hreflang target title data-dialog-type data-dialog-options> <table class="ct-theme-light ct-table ct-table--striped ct-theme-dark"> <cite> <dl> <dt> <dd> <img src alt data-entity-type data-entity-uuid> <drupal-entity alt title data-entity-type data-entity-uuid data-entity-embed-display data-entity-embed-display-settings data-align data-caption data-embed-button> <span class="ct-visually-hidden"> <svg role viewBox aria-hidden width height class="ct-icon"> <path d> <blockquote cite> <ul type> <ol type start> <drupal-media title data-entity-type data-entity-uuid alt data-caption data-align> <figure class data-component-id> <div class> <iframe width height src title allowfullscreen> <video controls class width height> <source src type> <strong> <em> <u> <s> <sub> <sup> <li> <tr> <td rowspan colspan> <th rowspan colspan> <thead> <tbody> <tfoot> <caption>'
4545
filter_html_help: true
4646
filter_html_nofollow: false
4747
filter_html_escape:
@@ -76,7 +76,6 @@ filters:
7676
weight: 0
7777
settings:
7878
title: true
79-
media_substitution: metadata
8079
media_embed:
8180
id: media_embed
8281
provider: media

web/themes/contrib/civictheme/includes/media.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ function civictheme_preprocess_media__civictheme_image(array &$variables): void
3333
if ($image->isValid()) {
3434
$variables['width'] = $image->getWidth();
3535
$variables['height'] = $image->getHeight();
36-
$variables['url'] = \Drupal::service('file_url_generator')->transformRelative($image_file->getFileUri());
36+
$image_url = \Drupal::service('file_url_generator')->generateString($image_file->getFileUri());
37+
$variables['url'] = \Drupal::service('file_url_generator')->transformRelative($image_url);
3738
$variables['alt'] = $media->get('field_c_m_image')->first()->get('alt')->getString();
3839
$variables['caption'] = $media->get('field_c_m_caption')->getString();
3940
}

web/themes/contrib/civictheme/includes/utilities.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ function civictheme_media_image_get_variables(MediaInterface $media, ?string $im
180180
}
181181

182182
$url = civictheme_media_image_get_url($media, $image_style);
183-
$variables['url'] = \Drupal::service('file_url_generator')->transformRelative($url);
183+
$image_url = \Drupal::service('file_url_generator')->generateString($url);
184+
$variables['url'] = \Drupal::service('file_url_generator')->transformRelative($image_url);
184185

185186
$image = $media
186187
->get($media->getSource()->getConfiguration()['source_field'])

0 commit comments

Comments
 (0)