You are here

function ocupload_update_7105 in One Click Upload 7

Same name and namespace in other branches
  1. 7.2 ocupload.install \ocupload_update_7105()

Add new col {ocupload_templates}.link_template Update colorbox integration Delete col {ocupload_templates}.show_in_colorbox

File

./ocupload.install, line 237
Install/Uninstall functions

Code

function ocupload_update_7105() {

  // Add field
  db_add_field('ocupload_templates', 'link_template', array(
    'description' => 'Link template',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '<a href="!filepath" target="_blank">!image</a>',
  ));

  // Update Colorbox integration
  module_load_include('module', 'ocupload');
  module_load_include('inc', 'ocupload');
  foreach (ocupload_templates() as $template) {
    if ($template->show_in_colorbox) {
      $template->link_template = '<a href="!filepath" class="colorbox" target="_blank">!image</a>';
      ocupload_template_save($template);
    }
  }

  // Delete field
  db_drop_field('ocupload_templates', 'show_in_colorbox');
}