public function EntityformTypeController::create in Entityform 7.2
Same name and namespace in other branches
- 7 entityform.module \EntityformTypeController::create()
Create a entityform type - we first set up the values that are specific to our entityform type schema but then also go through the EntityAPIController function.
Parameters
$type: The machine-readable type of the entityform.
Return value
A entityform type object with all default fields initialized.
Overrides EntityAPIController::create
File
- ./
entityform.module, line 1343 - Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface
Class
- EntityformTypeController
- The Controller for Entityform entities
Code
public function create(array $values = array(), $load_defaults = FALSE) {
// Add values that are specific to our Entityform
$default_values = variable_get('entityform_type_defaults', array());
if (empty($default_values)) {
$default_values = array();
}
$values += $default_values;
$values += array(
'id' => '',
'is_new' => TRUE,
);
if (!isset($values['data'])) {
$values['data'] = array();
}
if ($load_defaults) {
$values['data'] += array(
'submissions_view' => 'entityforms',
'user_submissions_view' => 'user_entityforms',
'preview_page' => 0,
);
$values['data'] += $this
->get_default_text_values();
}
else {
if ($values['is_new']) {
// Don't override values even if is_new. Features will send values in for checking status.
$values['data'] += array(
'submissions_view' => 'default',
'user_submissions_view' => 'default',
);
}
}
$entityform_type = parent::create($values);
return $entityform_type;
}