You are here

function insert_insert_content in Insert 6

Same name and namespace in other branches
  1. 7 includes/insert.inc \insert_insert_content()

Implementation of hook_insert_content().

File

includes/insert.inc, line 23
Insert support for generic files.

Code

function insert_insert_content($item, $style, $widget) {
  $style_name = $style['name'];
  if ($style_name == 'auto') {
    $info = @pathinfo($item['filepath']);
    if (in_array(strtolower($info['extension']), array(
      'png',
      'jpg',
      'jpeg',
      'gif',
    ))) {
      $style_name = 'image';
    }
  }
  if ($style_name == 'image') {
    return theme('insert_image', $item, $widget);
  }
  if ($style_name == 'icon_link') {
    return theme('insert_icon_link', $item, $widget);
  }
  else {
    return theme('insert_link', $item, $widget);
  }
}