You are here

public function ButtonController::create in Command Buttons 7

Implements EntityAPIControllerInterface.

Overrides EntityAPIController::create

File

includes/ButtonController.class.php, line 190
Contains the controller class for the OA Button entity.

Class

ButtonController
Entity controller class.

Code

public function create(array $values = array()) {
  $entity = (object) array(
    'bundle' => $values['bundle'],
    'language' => LANGUAGE_NONE,
    'is_new' => TRUE,
  );

  // Ensure basic fields are defined.
  $values += array(
    'bundle' => 'button',
    'title' => '',
    'name' => '',
    'module' => 'command_buttons',
    'status' => 1,
  );

  // Apply the given values.
  foreach ($values as $key => $value) {
    $entity->{$key} = $value;
  }
  return $entity;
}