You are here

function eck__bundle__add in Entity Construction Kit (ECK) 7

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

ADD Entity types.

Parameters

$form: Form array provided by the Form API

$form_state: array provided by the Form API

entity_type: (String) entity type

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 155
All of the menu, pages, and forms related to bundle administration.

Code

function eck__bundle__add($form, &$form_state, $entity_type) {
  $form['entity_type_name'] = array(
    '#type' => 'value',
    '#value' => $entity_type->name,
  );
  $form['bundle_label'] = array(
    '#type' => 'textfield',
    '#title' => "Type",
    '#description' => "A Human readable name for the bundle",
  );
  $form['bundle_name'] = array(
    '#type' => 'machine_name',
    '#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;
}