You are here

function eck__entity__form in Entity Construction Kit (ECK) 7

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

Sets up an entities form

Parameters

$form: Form array provided by the Form API

$form_state: array provided by the Form API

$entity: an object as returned by entity_load()

2 string references to 'eck__entity__form'
eck__entity__add in ./eck.entity.inc
Call back for the local action add (It adds a new entity)
eck__entity__edit in ./eck.entity.inc
Callback function for an entities edit page

File

./eck.entity.inc, line 314
All the menus, pages, and functionality related to administering entities.

Code

function eck__entity__form($form, $form_state, $entity) {
  $form['entity'] = array(
    '#type' => 'value',
    '#value' => $entity,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#weight' => 10000,
    '#value' => t('Save'),
  );
  field_attach_form($entity
    ->entityType(), $entity, $form, $form_state);
  return $form;
}