Elcodi\Store\GeoBundle\Form\LocationSelectorBuilder::buildRootSelector PHP Метод

buildRootSelector() защищенный Метод

Builds the root selector with all the first level options
protected buildRootSelector ( null | Elcodi\Component\Geo\ValueObject\LocationData $selectedLocation = null )
$selectedLocation null | Elcodi\Component\Geo\ValueObject\LocationData The selected option
    protected function buildRootSelector($selectedLocation = null)
    {
        $selectedOption = !is_null($selectedLocation) ? $selectedLocation->getId() : null;
        $rootLocations = $this->locationProvider->getRootLocations();
        if (empty($rootLocations)) {
            throw new \RuntimeException('No locations loaded, please populate your locations');
        }
        $locationExample = reset($rootLocations);
        $this->selects[] = $this->formatSelector($locationExample->getType(), $this->generateOptions($rootLocations), $selectedOption);
    }