You are here

function eck__bundle__edit_form_submit in Entity Construction Kit (ECK) 7.3

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

Budle edit form submit callback.

File

./eck.bundle.inc, line 355

Code

function eck__bundle__edit_form_submit($form, &$form_state) {
  $entity_type = $form_state['values']['entity_type'];
  $bundle = $form_state['values']['bundle'];

  // Save all form values starting from 'config_' to the $bundle->config array.
  $bundle_config = array();
  foreach ($form_state['values'] as $name => $value) {
    if (strpos($name, 'config_') === 0) {

      // We don't need 'config_' prefix.
      $bundle_config[substr($name, 7)] = $form_state['values'][$name];
    }
  }
  $bundle->config = $bundle_config;

  // Save the bundle object to the database.
  $bundle
    ->save();
  drupal_set_message(t('the bundle %bundle for entity type %entity_type has been updated.', array(
    '%bundle' => $bundle->label,
    '%entity_type' => $entity_type->label,
  )));
}