You are here

function eck__default_properties__form_submit in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 eck.default_properties.inc \eck__default_properties__form_submit()

Form submition callback for default properties.

1 call to eck__default_properties__form_submit()
eck__entity_type__form_submit in ./eck.entity_type.inc
Submit handler for adding an entity type.

File

./eck.default_properties.inc, line 107
Default properties are a grouping of a property and a behavior.

Code

function eck__default_properties__form_submit($form, &$state, $entity_type) {
  $entity_type = $state['values']['entity_type'];
  $dp = $state['values']['default_properties'];
  foreach ($dp as $property => $active) {
    if ($active) {
      $info = eck_get_default_property($property);
      $entity_type
        ->addProperty($property, $info['label'], $info['type'], $info['behavior']);
    }
    else {
      $entity_type
        ->removeProperty($property);
    }
  }
  $state['values']['entity_type'] = $entity_type;
}