function ResponsiveImageFieldDisplayTest::addTestImageStyleMappings
Same name in other branches
- 9 core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php \Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest::addTestImageStyleMappings()
- 10 core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php \Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest::addTestImageStyleMappings()
- 11.x core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php \Drupal\Tests\responsive_image\Functional\ResponsiveImageFieldDisplayTest::addTestImageStyleMappings()
Add image style mappings to the responsive image style entity.
Parameters
bool $empty_styles: If true, the image style mappings will get empty image styles.
5 calls to ResponsiveImageFieldDisplayTest::addTestImageStyleMappings()
- ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersEmptyStyle in core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageFieldDisplayTest.php - Test responsive image formatters when image style is empty.
- ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersLinkToFile in core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageFieldDisplayTest.php - Tests responsive image formatters on node display linked to the file.
- ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersLinkToNode in core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageFieldDisplayTest.php - Tests responsive image formatters on node display linked to the node.
- ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersPrivate in core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageFieldDisplayTest.php - Tests responsive image formatters on node display for private files.
- ResponsiveImageFieldDisplayTest::testResponsiveImageFieldFormattersPublic in core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageFieldDisplayTest.php - Tests responsive image formatters on node display for public files.
File
-
core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageFieldDisplayTest.php, line 111
Class
- ResponsiveImageFieldDisplayTest
- Tests responsive image display formatter.
Namespace
Drupal\Tests\responsive_image\FunctionalCode
protected function addTestImageStyleMappings($empty_styles = FALSE) {
if ($empty_styles) {
$this->responsiveImgStyle
->addImageStyleMapping('responsive_image_test_module.mobile', '1x', [
'image_mapping_type' => 'image_style',
'image_mapping' => '',
])
->addImageStyleMapping('responsive_image_test_module.narrow', '1x', [
'image_mapping_type' => 'sizes',
'image_mapping' => [
'sizes' => '(min-width: 700px) 700px, 100vw',
'sizes_image_styles' => [],
],
])
->addImageStyleMapping('responsive_image_test_module.wide', '1x', [
'image_mapping_type' => 'image_style',
'image_mapping' => '',
])
->save();
}
else {
$this->responsiveImgStyle
->addImageStyleMapping('responsive_image_test_module.mobile', '1x', [
'image_mapping_type' => 'image_style',
'image_mapping' => ResponsiveImageStyleInterface::EMPTY_IMAGE,
])
->addImageStyleMapping('responsive_image_test_module.mobile', '1.5x', [
'image_mapping_type' => 'image_style',
'image_mapping' => 'thumbnail',
])
->addImageStyleMapping('responsive_image_test_module.narrow', '1x', [
'image_mapping_type' => 'sizes',
'image_mapping' => [
'sizes' => '(min-width: 700px) 700px, 100vw',
'sizes_image_styles' => [
'large',
'medium',
],
],
])
->addImageStyleMapping('responsive_image_test_module.wide', '1x', [
'image_mapping_type' => 'image_style',
'image_mapping' => 'large',
])
->addImageStyleMapping('responsive_image_test_module.wide', '3x', [
'image_mapping_type' => 'image_style',
'image_mapping' => ResponsiveImageStyleInterface::ORIGINAL_IMAGE,
])
->save();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.