Log in
Model

Yesno

Magento\Config\Model\Config\Source\Yesno

What it does

This class provides a standardized Yes/No option source for Magento 2 system configuration fields.

Developers use it when creating admin configuration dropdowns that need simple boolean choices, by specifying it as the source model in system.xml.

It returns options in two formats: as an array of value-label pairs for dropdown rendering, or as a key-value array for programmatic use.

Public Methods

  • toOptionArray()
  • toArray()