function ImageFieldDisplayTestCase::testImageFieldFormatterAttributes

Test passing attributes into the image field formatters.

File

modules/image/image.test, line 1125

Class

ImageFieldDisplayTestCase
Test class to check that formatters and display settings are working.

Code

function testImageFieldFormatterAttributes() {
    $image = theme('image_formatter', array(
        'item' => array(
            'uri' => 'http://example.com/example.png',
            'attributes' => array(
                'data-image-field-formatter' => 'testFound',
            ),
            'alt' => t('Image field formatter attribute test.'),
            'title' => t('Image field formatter'),
        ),
    ));
    $this->assertTrue(stripos($image, 'testFound') > 0, 'Image field formatters can have attributes.');
}

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