You are here

function alinks_edit_form_submit in Alinks 7

Same name and namespace in other branches
  1. 6 alinks.module \alinks_edit_form_submit()

Process the edit alinks form

File

./alinks.module, line 500
this module allows users to associates defined text to links

Code

function alinks_edit_form_submit($form, &$form_state) {
  foreach ($form_state['values']['edit_alink'] as $id => $alink) {
    if ($alink['delete']) {
      db_delete('alinks')
        ->condition('id', $id)
        ->execute();
    }
    else {
      db_update('alinks')
        ->fields(array(
        'alink_start_boundary' => $alink['start_boundary_edit'],
        'alink_text' => $alink['word_edit'],
        'alink_end_boundary' => $alink['end_boundary_edit'],
        'alink_case_insensitive' => $alink['case_insensitive_edit'],
        'alink_url' => $alink['url_edit'],
        'url_title' => $alink['url_title_edit'],
        'alink_external' => $alink['external_edit'],
        'alink_class' => $alink['class_edit'],
        'alink_weight' => $alink['weight_edit'],
      ))
        ->condition('id', $id, '=')
        ->execute();
    }
  }
  drupal_set_message('Alinks succesfuly updated');
}