You are here

public function EntityformController::create in Entityform 7

Same name and namespace in other branches
  1. 7.2 entityform.module \EntityformController::create()

Create a entityform - we first set up the values that are specific to our entityform schema but then also go through the EntityAPIController function.

Parameters

$type: The machine-readable type of the entityform.

Return value

A entityform object with all default fields initialized.

Overrides EntityAPIController::create

File

./entityform.module, line 1202
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Class

EntityformController
The Controller for Entityform entities

Code

public function create(array $values = array()) {
  if (isset($values['type'])) {
    $type = entityform_get_types($values['type']);
  }
  if (empty($type)) {
    return NULL;
  }

  // Add values that are specific to our Entityform
  $values += array(
    'entityform_id' => '',
    'is_new' => TRUE,
    'title' => '',
    'created' => '',
    'changed' => '',
    'data' => '',
  );
  $entityform = parent::create($values);
  return $entityform;
}