Mercurial > hg > isophonics-drupal-site
comparison core/modules/responsive_image/src/ResponsiveImageStyleForm.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\responsive_image; | 3 namespace Drupal\responsive_image; |
4 | 4 |
5 use Drupal\Core\Url; | |
5 use Drupal\breakpoint\BreakpointManagerInterface; | 6 use Drupal\breakpoint\BreakpointManagerInterface; |
6 use Drupal\Core\Entity\EntityForm; | 7 use Drupal\Core\Entity\EntityForm; |
7 use Drupal\Core\Form\FormStateInterface; | 8 use Drupal\Core\Form\FormStateInterface; |
8 use Symfony\Component\DependencyInjection\ContainerInterface; | 9 use Symfony\Component\DependencyInjection\ContainerInterface; |
9 | 10 |
79 ], | 80 ], |
80 '#disabled' => (bool) $responsive_image_style->id() && $this->operation != 'duplicate', | 81 '#disabled' => (bool) $responsive_image_style->id() && $this->operation != 'duplicate', |
81 ]; | 82 ]; |
82 | 83 |
83 $image_styles = image_style_options(TRUE); | 84 $image_styles = image_style_options(TRUE); |
84 $image_styles[RESPONSIVE_IMAGE_ORIGINAL_IMAGE] = $this->t('- None (original image) -'); | 85 $image_styles[ResponsiveImageStyleInterface::ORIGINAL_IMAGE] = $this->t('- None (original image) -'); |
85 $image_styles[RESPONSIVE_IMAGE_EMPTY_IMAGE] = $this->t('- empty image -'); | 86 $image_styles[ResponsiveImageStyleInterface::EMPTY_IMAGE] = $this->t('- empty image -'); |
86 | 87 |
87 if ((bool) $responsive_image_style->id() && $this->operation != 'duplicate') { | 88 if ((bool) $responsive_image_style->id() && $this->operation != 'duplicate') { |
88 $description = $this->t('Select a breakpoint group from the installed themes and modules. Below you can select which breakpoints to use from this group. You can also select which image style or styles to use for each breakpoint you use.') . ' ' . $this->t("Warning: if you change the breakpoint group you lose all your image style selections for each breakpoint."); | 89 $description = $this->t('Select a breakpoint group from the installed themes and modules. Below you can select which breakpoints to use from this group. You can also select which image style or styles to use for each breakpoint you use.') . ' ' . $this->t("Warning: if you change the breakpoint group you lose all your image style selections for each breakpoint."); |
89 } | 90 } |
90 else { | 91 else { |
125 '#type' => 'details', | 126 '#type' => 'details', |
126 '#title' => $label, | 127 '#title' => $label, |
127 ]; | 128 ]; |
128 $image_style_mapping = $responsive_image_style->getImageStyleMapping($breakpoint_id, $multiplier); | 129 $image_style_mapping = $responsive_image_style->getImageStyleMapping($breakpoint_id, $multiplier); |
129 if (\Drupal::moduleHandler()->moduleExists('help')) { | 130 if (\Drupal::moduleHandler()->moduleExists('help')) { |
130 $description = $this->t('See the <a href=":responsive_image_help">Responsive Image help page</a> for information on the sizes attribute.', [':responsive_image_help' => \Drupal::url('help.page', ['name' => 'responsive_image'])]); | 131 $description = $this->t('See the <a href=":responsive_image_help">Responsive Image help page</a> for information on the sizes attribute.', [':responsive_image_help' => Url::fromRoute('help.page', ['name' => 'responsive_image'])->toString()]); |
131 } | 132 } |
132 else { | 133 else { |
133 $description = $this->t('Enable the Help module for more information on the sizes attribute.'); | 134 $description = $this->t('Enable the Help module for more information on the sizes attribute.'); |
134 } | 135 } |
135 $form['keyed_styles'][$breakpoint_id][$multiplier]['image_mapping_type'] = [ | 136 $form['keyed_styles'][$breakpoint_id][$multiplier]['image_mapping_type'] = [ |
285 'entity.responsive_image_style.edit_form', | 286 'entity.responsive_image_style.edit_form', |
286 ['responsive_image_style' => $responsive_image_style->id()] | 287 ['responsive_image_style' => $responsive_image_style->id()] |
287 ); | 288 ); |
288 } | 289 } |
289 else { | 290 else { |
290 $form_state->setRedirectUrl($this->entity->urlInfo('collection')); | 291 $form_state->setRedirectUrl($this->entity->toUrl('collection')); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 } | 295 } |