You are here

function eck__property_edit__form in Entity Construction Kit (ECK) 7.3

Property edit form.

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

File

./eck.properties.inc, line 209
Properties.

Code

function eck__property_edit__form($form, &$state, $entity_type_name, $property) {
  $entity_type = EntityType::loadByName($entity_type_name);
  $properties = $entity_type->properties;
  if (array_key_exists($property, $properties)) {
    $form['entity_type'] = array(
      '#type' => 'value',
      '#value' => $entity_type,
    );
    $form['property'] = array(
      '#type' => 'value',
      '#value' => $property,
    );
    $form['label'] = array(
      '#type' => 'textfield',
      '#title' => 'label',
      '#default_value' => $properties[$property]['label'],
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#weight' => 10000,
      '#value' => t('Save'),
    );
  }
  else {
    drupal_set_message('This property does not exists');
    drupal_goto(eck__entity_type__path() . "/{$entity_type->name}/property");
  }
  return $form;
}