Same name in other branches
  1. 7.x-3.x quicktabs.module \quicktabs_save()

Creates a new quicktab instance.

1 call to quicktabs_save()
quicktabs_update dans ./quicktabs.module
Updates an existing quicktab instance.

Fichier

./quicktabs.module, line 228

Code

function quicktabs_save($quicktab) {
    \Drupal::moduleHandler()->invokeAll('quicktabs_presave', $quicktab);
    $exists = quicktabs_load($quicktab->machine_name);
    if ($exists && empty($exists->in_code_only)) {
        $ret = drupal_write_record('quicktabs', $quicktab, 'machine_name');
        if ($ret == SAVED_UPDATED) {
            quicktabs_i18n_update_strings(array(
                $quicktab->machine_name,
            ));
        }
        else {
            return FALSE;
        }
    }
    else {
        $ret = drupal_write_record('quicktabs', $quicktab);
        if ($ret == SAVED_NEW) {
            quicktabs_i18n_update_strings(array(
                $quicktab->machine_name,
            ));
            \Drupal::moduleHandler()->invokeAll('quicktabs_insert', $quicktab);
        }
        else {
            return FALSE;
        }
    }
    \Drupal::moduleHandler()->invokeAll('quicktabs_save', $quicktab);
    return $quicktab;
}