Log in
Model

Yesno

Magento\Config\Model\Config\Source\Yesno

What it does

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

Developers use this class when creating configuration fields that require a simple binary choice, such as enabling or disabling features.

It implements the ArrayInterface to provide options in two formats: an array suitable for select dropdowns and a key-value array for direct value-to-label mapping.

Public Methods

  • toOptionArray()
  • toArray()