You are here

function panopoly_wysiwyg_update_7102 in Panopoly WYSIWYG 7

Add image classes to captions so responsive images don't break

File

./panopoly_wysiwyg.install, line 17
Install hooks for Panopoly WYSIWYG.

Code

function panopoly_wysiwyg_update_7102() {

  // Because of the way Drupal handles filter_format_load() we need to use the method
  // outlined here: https://www.drupal.org/node/1304930
  $format = filter_format_load('panopoly_wysiwyg_text');
  if (empty($format->filters)) {
    $filters = filter_list_format($format->format);
    $format->filters = array();
    foreach ($filters as $name => $filter) {
      foreach ($filter as $k => $v) {
        $format->filters[$name][$k] = $v;
      }
    }
  }

  // Add the 'panopoly_images_fix_captions' filter
  $format->filters['panopoly_images_fix_captions'] = array(
    'weight' => 0,
    'status' => 1,
  );

  // Save the updated format.
  filter_format_save($format);
}