You are here

function image_hotspots_node_submit in Image Hotspots 7.2

Implements hook_node_submit().

File

./image_hotspots.module, line 310
Main function of module.

Code

function image_hotspots_node_submit($node, $form, &$form_state) {
  if (isset($form_state['image_hotspot_fields'])) {
    foreach ($form_state['image_hotspot_fields'] as $hotspot_field) {
      $images = current($form_state['values'][$hotspot_field]);
      foreach ($images as $image) {
        if (!$image['fid']) {
          continue;
        }
        $language = entity_language('node', $node);
        if ($image['image_hotspot'] == '') {
          image_hotspots_db_delete($image['fid'], $language);
        }
        elseif ($image['image_hotspot_flag'] == 'create') {
          image_hotspots_db_save($image['fid'], $language, $image['image_hotspot']);
        }
        elseif ($image['image_hotspot_flag'] == 'update') {
          image_hotspots_db_update($image['fid'], $language, $image['image_hotspot']);
        }
      }
    }
  }
}