public function UserDashboardSectionStorage::save in Dashboards with Layout Builder 8
Same name and namespace in other branches
- 2.0.x src/Plugin/SectionStorage/UserDashboardSectionStorage.php \Drupal\dashboards\Plugin\SectionStorage\UserDashboardSectionStorage::save()
Saves the sections.
Return value
int SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed.
Overrides DashboardSectionStorage::save
File
- src/
Plugin/ SectionStorage/ UserDashboardSectionStorage.php, line 122
Class
- UserDashboardSectionStorage
- Class DashboardSectionStorage.
Namespace
Drupal\dashboards\Plugin\SectionStorageCode
public function save() {
$sections = [];
foreach ($this
->getDashboard()
->get('sections') as $delta => $section) {
$sections[$delta] = $section
->toArray();
}
$this->userData
->set('dashboards', $this->account
->id(), $this
->getDashboard()
->id(), serialize($sections));
return SAVED_UPDATED;
}