You are here

function eck__bundle__add_submit in Entity Construction Kit (ECK) 7

Same name and namespace in other branches
  1. 7.3 eck.bundle.inc \eck__bundle__add_submit()
  2. 7.2 eck.bundle.inc \eck__bundle__add_submit()

Submit function for add form

Parameters

$form: Form array provided by the Form API

$form_state: array provided by the Form API

File

./eck.bundle.inc, line 215
All of the menu, pages, and forms related to bundle administration.

Code

function eck__bundle__add_submit($form, &$form_state) {
  $entity_type_name = $form_state['values']['entity_type_name'];
  $bundle_name = $form_state['values']['bundle_name'];
  $bundle_label = $form_state['values']['bundle_label'];
  db_insert('eck_bundle')
    ->fields(array(
    'entity_type' => $entity_type_name,
    'name' => $bundle_name,
    'label' => $bundle_label,
  ))
    ->execute();
  drupal_set_message(t('the %bundle for entity type %entity_type has been saved', array(
    '%bundle' => $bundle_name,
    '%entity_type' => $entity_type_name,
  )));
  drupal_get_schema(NULL, TRUE);
  entity_info_cache_clear();
  menu_rebuild();
  drupal_goto("admin/structure/eck/{$entity_type_name}/{$bundle_name}");
}