You are here

function eck__bundle__add in Entity Construction Kit (ECK) 7.2

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

Bundle add from callback.

1 string reference to 'eck__bundle__add'
eck__bundle__menu in ./eck.bundle.inc
This function creates the menu items relevant to bundle administration.

File

./eck.bundle.inc, line 238

Code

function eck__bundle__add($form, &$form_state, $entity_type) {
  $entity_type = entity_type_load($entity_type);
  $form['entity_type'] = array(
    '#type' => 'value',
    '#value' => $entity_type,
  );
  $form['bundle_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Type'),
    '#description' => "A Human readable name for the bundle",
  );
  $form['bundle_name'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 32,
    '#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores. Maximum length 32 characters.'),
    '#required' => FALSE,
    '#machine_name' => array(
      'exists' => '_eck_fake_exists',
      'source' => array(
        'bundle_label',
      ),
    ),
  );
  $form['#validate'][] = 'eck__bundle__add_validate';
  $form['submit'] = array(
    '#type' => 'submit',
    '#weight' => 10000,
    '#value' => t('Save'),
  );
  return $form;
}