You are here

function media_crop_pre_render_text_format in Media crop 7

Process function for adding necessary js to the editor.

1 string reference to 'media_crop_pre_render_text_format'
media_crop_element_info_alter in ./media_crop.module
Implements hook_element_info_alter().

File

./media_crop.module, line 1067
Media crop primary module file.

Code

function media_crop_pre_render_text_format($element) {

  // filter_process_format() copies properties to the expanded 'value' child
  // element. Skip this text format widget, if it contains no 'format' or when
  // the current user does not have access to edit the value.
  if (!isset($element['format']) || !empty($element['value']['#disabled'])) {
    return $element;
  }

  // Allow modules to programmatically enforce no client-side editor by setting
  // the #wysiwyg property to FALSE.
  if (isset($element['#wysiwyg']) && !$element['#wysiwyg']) {
    return $element;
  }
  $path = drupal_get_path('module', 'media_crop');
  drupal_add_js($path . '/js/media_crop.image_replace.js');
  return $element;
}