class FlexifromFormEntityNewReply in Flexiform 7
Form entity to get a new reply.
Hierarchy
- class \FlexiformFormEntityBase implements FlexiformFormEntityInterface
- class \FlexifromFormEntityNewReply
Expanded class hierarchy of FlexifromFormEntityNewReply
1 string reference to 'FlexifromFormEntityNewReply'
File
- includes/
form_entity/ reply.form_entity.inc, line 10 - Contains class for a basic entity getter.
View source
class FlexifromFormEntityNewReply extends FlexiformFormEntityBase {
/**
* {@inheritdoc}
*/
public function getEntity() {
parent::getEntity();
$base_type = $this
->getParamType('base');
// Get the base entity.
$base_entity = $this
->getParam('base');
// Check we have enough information to load the entity.
if (!$base_entity) {
return FALSE;
}
$base_settings = $this
->getParamSettings('base');
$base_bundle = $base_settings['bundle'];
$instance = field_info_instance($base_type, $this->getter['field_name'], $base_bundle);
$instance_id = $instance['id'];
$base_id = entity_id($base_type, $base_entity);
$values = array(
'entity_id' => $base_id,
'instance_id' => $instance_id,
'entity_type' => $base_type,
'bundle' => $this->settings['bundle'],
);
$new_reply = entity_create('reply', $values);
if (!$new_reply) {
return FALSE;
}
return $new_reply;
}
/**
* {@inheritdoc}
*/
public function saveEntity($entity) {
// If the entity is still false do not save it!
if ($entity === FALSE) {
return;
}
$base_id = entity_id($this
->getParamType('base'), $this
->getParam('base'));
$entity->entity_id = $base_id;
parent::saveEntity($entity);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FlexiformFormEntityBase:: |
public | property | The namespace of this entity. | |
FlexiformFormEntityBase:: |
public | property | The type of this entity. | |
FlexiformFormEntityBase:: |
public | property | Details of the getter. | |
FlexiformFormEntityBase:: |
public | property | The Flexiform Entity Manager | |
FlexiformFormEntityBase:: |
public | property | The settings for this entity on the flexiform. | |
FlexiformFormEntityBase:: |
public | function | Check bundle. | |
FlexiformFormEntityBase:: |
public | function |
Get the Configuration Form. Overrides FlexiformFormEntityInterface:: |
3 |
FlexiformFormEntityBase:: |
public | function |
Submit the Configuration Form. Overrides FlexiformFormEntityInterface:: |
|
FlexiformFormEntityBase:: |
public | function |
Validate the configuration form. Overrides FlexiformFormEntityInterface:: |
|
FlexiformFormEntityBase:: |
public | function | Get a Parameter From the Entity Manager. | |
FlexiformFormEntityBase:: |
public | function | Get a Parameter's entity settings from the Entity Manager. | |
FlexiformFormEntityBase:: |
public | function | Get the entity type of a parameter. | |
FlexiformFormEntityBase:: |
public | function | Construct a Flexiform Form Entity class. | |
FlexifromFormEntityNewReply:: |
public | function |
Get the entity for the form. Overrides FlexiformFormEntityBase:: |
|
FlexifromFormEntityNewReply:: |
public | function |
Save the entity upon submission of the form. Overrides FlexiformFormEntityBase:: |