class FlexiformBuilderEntityForm in Flexiform 7
Flexiform Builder Class for stock entity forms.
Hierarchy
- class \FlexiformBuilder implements FlexiformBuilderInterface
- class \FlexiformBuilderEntityForm
Expanded class hierarchy of FlexiformBuilderEntityForm
2 string references to 'FlexiformBuilderEntityForm'
- flexiform_flexiform_builder_info in ./
flexiform.flexiform.inc - Implements hook_flexiform_builder_info().
- hook_flexiform_builder_info in ./
flexiform.api.php - Register builder classes with the Flexiform system.
File
- includes/
builder/ entity_form.builder.inc, line 10 - Contains the FlexiformBuilderEntityForm Class
View source
class FlexiformBuilderEntityForm extends FlexiformBuilder {
/**
* Attach all fields for this entity to the form.
*/
public function form($form, &$form_state) {
$form = parent::form($form, $form_state);
$form['#tree'] = TRUE;
field_attach_form($this->base_entity_type, $this->base_entity, $form, $form_state);
$this
->invoke($form, $form_state);
return $form;
}
/**
* Validate the Fields
*/
public function formValidate($form, &$form_state) {
field_attach_form_validate($this->base_entity_type, $this->base_entity, $form, $form_state);
$this
->invoke($form, $form_state, 'validate');
}
/**
* Submit the form.
*/
public function formSubmit($form, &$form_state) {
field_attach_submit($this->base_entity_type, $this->base_entity, $form, $form_state);
$this
->invoke($form, $form_state, 'submit');
entity_save($this->base_entity_type, $this->base_entity);
if (module_exists('rules')) {
$base_entity_wrapper = entity_metadata_wrapper($this->flexiform->base_entity, $form['#flexiform_base_entity']);
$args = array(
'base_entity' => $base_entity_wrapper,
);
// Fire the most specific rules first and track back to the less specific.
rules_invoke_event_by_args('flexiform_submit_' . $this->flexiform->form, array(
'base_entity' => $this->base_entity,
));
rules_invoke_event_by_args('flexiform_group_submit_' . $this->flexiform->form_group, $args);
rules_invoke_event_by_args('flexiform_any_submit', $args);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FlexiformBuilder:: |
protected | property | The base entity. | |
FlexiformBuilder:: |
protected | property | The base entity type. | |
FlexiformBuilder:: |
protected | property | The flexiform object. | |
FlexiformBuilder:: |
public | function | Submit the form and set up the redirect. | |
FlexiformBuilder:: |
public | function | Get an array of ctools context for the flexiform. | |
FlexiformBuilder:: |
public | function | Build a list of possible ctools substitutions. | |
FlexiformBuilder:: |
public | function | Get the Flexiform. | |
FlexiformBuilder:: |
public | function | Get a form entity. | 1 |
FlexiformBuilder:: |
public | function | Invoke hooks to alter the build of this form. | |
FlexiformBuilder:: |
public | function | Replace ctools substitutions with their values. | |
FlexiformBuilder:: |
public | function |
Support Components. Overrides FlexiformBuilderInterface:: |
1 |
FlexiformBuilder:: |
public | function | Construct the Flexiform Builder. | |
FlexiformBuilderEntityForm:: |
public | function |
Attach all fields for this entity to the form. Overrides FlexiformBuilder:: |
|
FlexiformBuilderEntityForm:: |
public | function |
Submit the form. Overrides FlexiformBuilder:: |
|
FlexiformBuilderEntityForm:: |
public | function |
Validate the Fields Overrides FlexiformBuilder:: |