public function EntityBundlePluginEntityControllerExportable::create in Entity bundle plugin 7
Overrides EntityAPIControllerExportable::create().
Overrides EntityAPIController::create
1 call to EntityBundlePluginEntityControllerExportable::create()
File
- ./
entity_bundle_plugin.controller.inc, line 78 - Entity base controller for EntityBundlePlugin.
Class
Code
public function create(array $values = array()) {
if (!isset($values[$this->entityInfo['entity keys']['bundle']])) {
throw new Exception(t('No bundle provided to EntityBundlePluginEntityControllerExportable::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);
}