Provide a sane default for the displays.
parent
4ed293f8a5
commit
b93c8e0e54
|
@ -104,7 +104,17 @@ class ViewStorageController extends ConfigStorageController {
|
||||||
* Overrides Drupal\config\ConfigStorageController::create().
|
* Overrides Drupal\config\ConfigStorageController::create().
|
||||||
*/
|
*/
|
||||||
public function create(array $values) {
|
public function create(array $values) {
|
||||||
|
|
||||||
|
// If there is no information about displays available add at least the
|
||||||
|
// default display.
|
||||||
|
$values += array(
|
||||||
|
'display' => array(
|
||||||
|
'default' => array()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$entity = parent::create($values);
|
$entity = parent::create($values);
|
||||||
|
|
||||||
$this->attachDisplays($entity);
|
$this->attachDisplays($entity);
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1507,9 +1507,7 @@ function views_get_all_templates() {
|
||||||
* it can be successfully saved.
|
* it can be successfully saved.
|
||||||
*/
|
*/
|
||||||
function views_new_view() {
|
function views_new_view() {
|
||||||
$view = new View();
|
$view = entity_create('view', array());
|
||||||
$view->vid = 'new';
|
|
||||||
$view->add_display('default');
|
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue