You are here

function instagram_feeds_moderation_node_form_submit in Instagram Feeds 7

Custom node form submit function.

Save Instagram feed node and redirect to image managment page.

1 string reference to 'instagram_feeds_moderation_node_form_submit'
instagram_feeds_moderation_form_alter in modules/instagram_feeds_moderation/instagram_feeds_moderation.module
Implements hook_form_alter().

File

modules/instagram_feeds_moderation/instagram_feeds_moderation.module, line 218

Code

function instagram_feeds_moderation_node_form_submit($form, &$form_state) {
  $node = node_form_submit_build_node($form, $form_state);
  node_save($node);
  $node_link = l(t('view'), 'node/' . $node->nid);
  $watchdog_args = array(
    '@type' => $node->type,
    '%title' => $node->title,
  );
  $t_args = array(
    '@type' => node_type_get_name($node),
    '%title' => $node->title,
  );
  watchdog('content', '@type: updated %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
  drupal_set_message(t('@type %title has been updated.', $t_args));

  // Clear the page and block caches.
  cache_clear_all();
  if (isset($_GET['destination'])) {
    unset($_GET['destination']);
  }
  $form_state['redirect'] = array(
    'admin/content/instagram/media',
    array(
      'query' => array(
        'feed' => $node->nid,
      ),
    ),
  );
}