Airship\Cabin\Bridge\Landing\Account::savePreferences PHP Method

savePreferences() protected method

Save a user's preferences
protected savePreferences ( array $prefs = [], array $cabins = [], array $motifs = [] ) : boolean
$prefs array
$cabins array
$motifs array
return boolean
    protected function savePreferences(array $prefs = [], array $cabins = [], array $motifs = []) : bool
    {
        // Validate the motifs
        foreach ($prefs['motif'] as $cabin => $selectedMotif) {
            if (!\in_array($cabin, $cabins)) {
                unset($prefs['motif'][$cabin]);
                continue;
            }
            if (empty($selectedMotif)) {
                $prefs['motif'][$cabin] = null;
                continue;
            }
            list($supplier, $motifName) = \explode('/', $selectedMotif);
            if (!$this->findMotif($motifs[$cabin], $supplier, $motifName)) {
                $prefs['motif'][$cabin] = null;
                continue;
            }
        }
        if ($this->acct->updatePreferences($this->getActiveUserId(), $prefs)) {
            $this->storeLensVar('post_response', ['message' => \__('Preferences saved successfully.'), 'status' => 'success']);
            return true;
        }
        return false;
    }