You are here

function theme_iframe in Iframe 6

FAPI theme for an individual text elements.

File

./iframe.module, line 470
Defines simple iframe field types. based on the cck-module "link" by quicksketch MODULE-Funtions

Code

function theme_iframe($element) {
  dmsg(3, 'func theme_iframe');
  drupal_add_css(drupal_get_path('module', 'iframe') . '/iframe.css');

  // Prefix single value iframe fields with the name of the field.
  if (empty($element['#field']['multiple'])) {
    if (isset($element['url']) && isset($element['title'])) {
      $element['url']['#title'] = $element['#title'] . ' ' . $element['url']['#title'];
      $element['title']['#title'] = $element['#title'] . ' ' . $element['title']['#title'];
    }
    elseif ($element['url']) {
      $element['url']['#title'] = $element['#title'];
    }
  }
  $output = '';
  $output .= '<div class="iframe-field-subrow clear-block">';
  if (isset($element['title'])) {
    $output .= '<div class="iframe-field-title iframe-field-column">' . theme('textfield', $element['title']) . '</div>';
  }
  $output .= '<div class="iframe-field-url' . (isset($element['title']) ? ' iframe-field-column' : '') . '">' . theme('textfield', $element['url']) . '</div>';
  $output .= '<div>' . t('Width and Height of the IFrame') . '</div>';
  if (!empty($element['attributes'])) {
    foreach ($element['attributes'] as $key => $attr) {
      if (!isset($attr['#type'])) {
        continue;
      }
      $value = isset($attr['#value']) ? $attr['#value'] : '';
      $output .= '<div class="iframe-attributes iframe-field-column">' . theme($attr['#type'], $attr, $value) . '</div>';
    }
  }
  $output .= '</div>';
  return $output;
}