You are here

function eck__bundle__edit_form in Entity Construction Kit (ECK) 7.3

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

Form constructor for the entity bundle editing form.

Parameters

string $entity_type_name: Entity type name.

string $bundle_name: Entity bundle name.

1 string reference to 'eck__bundle__edit_form'
eck__entity__menu in ./eck.entity.inc
Entity related menu items.

File

./eck.bundle.inc, line 322

Code

function eck__bundle__edit_form($form, &$form_state, $entity_type_name, $bundle_name) {
  $path = eck__entity_type__path();
  $entity_type = entity_type_load($entity_type_name);
  $bundle = bundle_load($entity_type_name, $bundle_name);
  $form = array();
  $form['entity_type'] = array(
    '#type' => 'value',
    '#value' => $entity_type,
  );
  $form['bundle'] = array(
    '#type' => 'value',
    '#value' => $bundle,
  );

  // Let the behaviors to modify form.
  $vars = eck_property_behavior_invoke_plugin_alter($entity_type, 'bundle_form', array(
    'form' => $form,
    'form_state' => $form_state,
  ));
  $form = $vars['form'];
  $form_state = $vars['form_state'];
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save bundle'),
    '#weight' => 40,
  );
  return $form;
}