function OEmbedFormatterTest::providerRender

Same name in other branches
  1. 9 core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php \Drupal\Tests\media\Functional\FieldFormatter\OEmbedFormatterTest::providerRender()
  2. 8.9.x core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php \Drupal\Tests\media\Functional\FieldFormatter\OEmbedFormatterTest::providerRender()
  3. 10 core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php \Drupal\Tests\media\Functional\FieldFormatter\OEmbedFormatterTest::providerRender()

Data provider for testRender().

Return value

array

See also

::testRender()

File

core/modules/media/tests/src/Functional/FieldFormatter/OEmbedFormatterTest.php, line 62

Class

OEmbedFormatterTest
@covers \Drupal\media\Plugin\Field\FieldFormatter\OEmbedFormatter

Namespace

Drupal\Tests\media\Functional\FieldFormatter

Code

public static function providerRender() {
    return [
        'Vimeo video' => [
            'https://vimeo.com/7073899',
            'video_vimeo.json',
            [],
            [
                'iframe' => [
                    'src' => '/media/oembed?url=https%3A//vimeo.com/7073899',
                    'width' => '480',
                    'height' => '360',
                    'title' => 'Drupal Rap Video - Schipulcon09',
                    'loading' => 'lazy',
                    // cSpell:disable-next-line
'allowtransparency' => NULL,
                    'frameborder' => NULL,
                ],
            ],
            'self_closing' => TRUE,
        ],
        'Vimeo video, resized' => [
            'https://vimeo.com/7073899',
            'video_vimeo-resized.json',
            [
                'max_width' => '100',
                'max_height' => '100',
            ],
            [
                'iframe' => [
                    'src' => '/media/oembed?url=https%3A//vimeo.com/7073899&max_width=100&max_height=100',
                    'width' => '100',
                    'height' => '67',
                    'title' => 'Drupal Rap Video - Schipulcon09',
                    'loading' => 'lazy',
                ],
            ],
            'self_closing' => TRUE,
        ],
        'Vimeo video, no title' => [
            'https://vimeo.com/7073899',
            'video_vimeo-no-title.json',
            [],
            [
                'iframe' => [
                    'src' => '/media/oembed?url=https%3A//vimeo.com/7073899',
                    'width' => '480',
                    'height' => '360',
                    'title' => NULL,
                    'loading' => 'lazy',
                ],
            ],
            'self_closing' => TRUE,
        ],
        'tweet' => [
            'https://twitter.com/drupaldevdays/status/935643039741202432',
            'rich_twitter.json',
            [
                // The tweet resource does not specify a height, so the formatter
                // should default to the configured maximum height.
'max_height' => 360,
                'loading' => [
                    'attribute' => 'eager',
                ],
            ],
            [
                'iframe' => [
                    'src' => '/media/oembed?url=https%3A//twitter.com/drupaldevdays/status/935643039741202432',
                    'width' => '550',
                    'height' => '360',
                    'loading' => 'eager',
                ],
            ],
            'self_closing' => TRUE,
        ],
        'Flickr photo' => [
            'https://www.flickr.com/photos/amazeelabs/26497866357',
            'photo_flickr.json',
            [],
            [
                'img' => [
                    'src' => '/core/misc/druplicon.png',
                    'width' => '88',
                    'height' => '100',
                    'loading' => 'lazy',
                ],
            ],
            'self_closing' => FALSE,
        ],
        'Flickr photo (no dimensions)' => [
            'https://www.flickr.com/photos/amazeelabs/26497866357',
            'photo_flickr_no_dimensions.json',
            [],
            [
                'img' => [
                    'src' => '/core/misc/druplicon.png',
                    'loading' => 'lazy',
                ],
            ],
            'self_closing' => FALSE,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.