src/Forms/RegionSelectionField.php
public function Field($properties = [])
    {
        Requirements::javascript("silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js");

        $country_field = $this->country_field;
        
        // Get source based on selected country (or current/default locale)
        $field = $this
            ->getForm()
            ->Fields()
            ->dataFieldByName($country_field);
        
        // Add reference to base field
        $this
            ->setAttribute("data-region-field", true)
            ->setAttribute("data-country-field", $field->ID())
            ->setAttribute("data-link", $this->Link("regionslist"));
        
        if ($this->getHasEmptyDefault()) {
            $this->setAttribute("data-empty-string", $this->getEmptyString());
        }

        return parent::Field($properties);
    }
public function Field($properties = [])
    {
        Requirements::javascript("silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js");

        $country_field = $this->country_field;
        
        // Get source based on selected country (or current/default locale)
        $field = $this
            ->getForm()
            ->Fields()
            ->dataFieldByName($country_field);
        
        // Add reference to base field
        $this
            ->setAttribute("data-region-field", true)
            ->setAttribute("data-country-field", $field->ID())
            ->setAttribute("data-link", $this->Link("regionslist"));
        
        if ($this->getHasEmptyDefault()) {
            $this->setAttribute("data-empty-string", $this->getEmptyString());
        }

        return parent::Field($properties);
    }
public function Field ( $ properties = [ ] ) { Requirements :: javascript ( "silvercommerce/geozones: client/dist/js/RegionSelectionField.min.js" ) ; $ country_field = $ this -> country_field ; // Get source based on selected country (or current/default locale) $ field = $ this -> getForm ( ) -> Fields ( ) -> dataFieldByName ( $ country_field ) ; // Add reference to base field $ this -> setAttribute ( "data-region-field" , true ) -> setAttribute ( "data-country-field" , $ field -> ID ( ) ) -> setAttribute ( "data-link" , $ this -> Link ( "regionslist" ) ) ; if ( $ this -> getHasEmptyDefault ( ) ) { $ this -> setAttribute ( "data-empty-string" , $ this -> getEmptyString ( ) ) ; } return parent :: Field ( $ properties ) ; }
Render the final field
Render the final field