You are here

function oembed_alt_attr in oEmbed 7.0

Same name and namespace in other branches
  1. 8 oembed.module \oembed_alt_attr()
  2. 7 oembed.module \oembed_alt_attr()

Generate a string for use as ALT attribute.

6 calls to oembed_alt_attr()
OembedEndpointTestCase::testOembedEndpoint in oembedprovider/oembedprovider.test
OembedProviderTestCase::testOembedProviders in oembedprovider/oembedprovider.test
oembed_file_presave in ./oembed.file.inc
Implements hook_file_presave().
oembed_pre_render_image_helper in ./oembed.module
Set the properties for a themed image.
theme_oembed in theme/oembed.theme.inc
Theme for oEmbed output.

... See full list

File

./oembed.module, line 512

Code

function oembed_alt_attr($embed) {
  $options = array(
    '@type' => $embed['type'],
  );

  // alt attribute using hopefully available title and provider name.
  if (isset($embed['title'])) {
    $string = '@title';
    $options['@title'] = $embed['title'];
  }
  else {
    $string = 'Embedded @type';
  }
  if (isset($embed['provider_name'])) {
    $string .= ' on @provider_name';
    $options['@provider_name'] = $embed['provider_name'];
  }
  return t($string, $options);
}