create default composition on first studioUI load
This commit is contained in:
@@ -157,12 +157,22 @@ class StudioUIController extends ControllerBase {
|
||||
|
||||
$compos_ids = $query->execute();
|
||||
// dpm($compos_ids);
|
||||
if(count($compos_ids)){
|
||||
$compos = entity_load_multiple('composition', $compos_ids);
|
||||
}else{
|
||||
$compos = array();
|
||||
|
||||
if(!count($compos_ids)){
|
||||
// create default compos
|
||||
$def_compos = \Drupal::entityManager()
|
||||
->getStorage('composition')
|
||||
->create(array(
|
||||
'name' => 'composition',
|
||||
'uid' => $this->user->id()
|
||||
)
|
||||
);
|
||||
$def_compos->save();
|
||||
$compos_ids = array($def_compos->id());
|
||||
}
|
||||
|
||||
$compos = entity_load_multiple('composition', $compos_ids);
|
||||
|
||||
$createurl = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action' => 'create'], ['absolute' => TRUE]);
|
||||
|
||||
return array(
|
||||
|
||||
Reference in New Issue
Block a user