Log in
Model

Country

Magento\Directory\Model\Config\Source\Country

What it does

This class provides a list of countries as option arrays for use in dropdown menus and multi-select fields in Magento's admin panel and frontend forms.

Developers use this class when creating system configuration fields or custom forms that need a country selector, as it automatically loads all available countries from the database and formats them for display.

Public Methods

  • toOptionArray()