/** * Saves the current Panels display in the tempstore or real storage.. * * @param \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display * The Panels display to be saved. * @param bool $temp * Whether or not to save to temp store. * * @return \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant * The Panels display that was saved. * * @throws \Drupal\user\TempStoreException * If there are any issues manipulating the entry in the temp store. */ protected function savePanelsDisplay(PanelsDisplayVariant $panels_display, $temp = TRUE) { $temp_store_key = $panels_display->id(); // Save configuration to temp store. if ($temp) { $this->tempStore->set($temp_store_key, $panels_display->getConfiguration()); } else { // Check to see if temp store has configuration saved. if ($variant_config = $this->tempStore->get($temp_store_key)) { // Delete the existing temp store value. $this->tempStore->delete($temp_store_key); } // Save to the real storage. $this->panelsStorage->save($panels_display); } return $panels_display; }
/** * Deletes TempStore and saves the current Panels display. * * @param \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display * The Panels display to be saved. * * @throws \Drupal\user\TempStoreException * If there are any issues manipulating the entry in the temp store. */ protected function savePanelsDisplay(PanelsDisplayVariant $panels_display) { $this->deletePanelsDisplayTempStore($panels_display); $this->panelsStore->save($panels_display); }