calendarList(); if (isset($calendars['error'])) { $calendars = ''; } $this->vars['calendars'] = $calendars; $this->vars['saved_selector'] = $this->extractIds(); return $this->makePartial('selector'); } private function extractIds() { $calendarSelectors = Settings::get('calendar_selector', []); $ids = []; foreach ($calendarSelectors as &$selector) { $ids[] = $selector['id']; } return $ids; } }