public function EntityBundlePluginEntityController::create in Entity bundle plugin 7
Overrides EntityAPIController::create().
Overrides EntityAPIController::create
1 call to EntityBundlePluginEntityController::create()
File
- ./
entity_bundle_plugin.controller.inc, line 30 - Entity base controller for EntityBundlePlugin.
Class
- EntityBundlePluginEntityController
- @file Entity base controller for EntityBundlePlugin.
Code
public function create(array $values = array()) {
if (!isset($values[$this->entityInfo['entity keys']['bundle']])) {
throw new Exception(t('No bundle provided to EntityBundlePluginEntityController::create().'));
}
// Add is_new property if it is not set.
$values += array(
'is_new' => TRUE,
);
ctools_include('plugins');
$class = ctools_plugin_load_class($this->entityInfo['module'], $this->entityInfo['bundle plugin']['plugin type'], $values[$this->entityInfo['entity keys']['bundle']], 'class');
if (!class_exists($class)) {
if (!empty($this->entityInfo['bundle plugin']['broken class'])) {
$class = $this->entityInfo['bundle plugin']['broken class'];
}
else {
throw new Exception(t('Trying to load an object with a broken plugin type @type', array(
'@type' => $values[$this->entityInfo['entity keys']['bundle']],
)));
}
}
return new $class($values, $this->entityType);
}