Classes, traits, and interfaces - main - drupal

Primary tabs

Introduction to classes

A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.

See also

Objected-oriented programming conventions

File

core/core.api.php, line 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
FormStateDecoratorBase abstract class Drupal\Core\Form core/lib/Drupal/Core/Form/FormStateDecoratorBase.php Decorates another form state. 2 1
FormStateDecoratorBaseTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php Tests Drupal\Core\Form\FormStateDecoratorBase.
FormStateInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormStateInterface.php Provides an interface for an object containing the current state of a form. 3 924
FormStatePersistTest class Drupal\Tests\system\Kernel\Form core/modules/system/tests/src/Kernel/Form/FormStatePersistTest.php Tests that the form state persists across multiple requests.
FormStateTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateTest.php Tests Drupal\Core\Form\FormState.
FormStateValuesTrait trait Drupal\Core\Form core/lib/Drupal/Core/Form/FormStateValuesTrait.php Provides methods to manage form state values. 1
FormStateValuesTraitStub class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php Stub class with trait for testing.
FormStateValuesTraitTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php Tests Drupal\Core\Form\FormStateValuesTrait.
FormStoragePageCacheTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php Tests form storage from cached pages.
FormSubmitter class Drupal\Core\Form core/lib/Drupal/Core/Form/FormSubmitter.php Provides submission processing for forms. 1 2 2
FormSubmitterInterface interface Drupal\Core\Form core/lib/Drupal/Core/Form/FormSubmitterInterface.php Provides an interface for processing form submissions. 2 1
FormSubmitterTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php Tests Drupal\Core\Form\FormSubmitter.
FormTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/FormTest.php Tests various form element validation mechanisms.
FormTest class Drupal\Tests\field\Functional core/modules/field/tests/src/Functional/FormTest.php Tests field form handling.
FormTestAlterForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php Form builder for testing hook_form_alter() and hook_form_FORM_ID_alter(). 1 1
FormTestArgumentsObject class Drupal\form_test core/modules/system/tests/modules/form_test/src/FormTestArgumentsObject.php Provides a test form object that needs arguments. 1
FormTestAutocompleteForm class Drupal\form_test core/modules/system/tests/modules/form_test/src/FormTestAutocompleteForm.php Defines a test form using autocomplete textfields. 1
FormTestBase abstract class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormTestBase.php Provides a base class for testing form functionality. 1
FormTestButtonClassForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestButtonClassForm.php Builds a simple form to test form button classes. 1
FormTestCheckboxesRadiosForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesRadiosForm.php Form constructor to test expansion of #type checkboxes and radios. 1
FormTestCheckboxesZeroForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxesZeroForm.php Tests checkboxes zero. 1
FormTestCheckboxForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxForm.php Form for testing checkbox. 1
FormTestCheckboxTypeJugglingForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestCheckboxTypeJugglingForm.php Builds a form to test return values for checkboxes.
FormTestClickedButtonForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestClickedButtonForm.php Form builder to test button click detection. 1
FormTestColorForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestColorForm.php Form constructor for testing #type 'color' elements. 1
FormTestController class Drupal\form_test\Controller core/modules/system/tests/modules/form_test/src/Controller/FormTestController.php Controller routines for form_test routes.
FormTestControllerObject class Drupal\form_test core/modules/system/tests/modules/form_test/src/FormTestControllerObject.php Provides a test form object. 1
FormTestDescriptionForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestDescriptionForm.php Defines a form for testing form element description display options. 1
FormTestDetailsContainsRequiredFieldsForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestDetailsContainsRequiredFieldsForm.php Builds a form to test required fields within details elements. 1
FormTestDetailsContainsRequiredTextfieldForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestDetailsContainsRequiredTextfieldForm.php Builds a form to test a required textfield within a details element.
FormTestDetailsForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestDetailsForm.php Builds a simple form to test the #group property on #type 'container'. 1
FormTestDisabledElementsForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestDisabledElementsForm.php Builds a form to test disabled elements. 1 1
FormTestEmailForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestEmailForm.php Form constructor for testing #type 'email' elements. 1
FormTestEmptySelectForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestEmptySelectForm.php Builds a form to test select elements when #options is not an array. 1
FormTestEventSubscriber class Drupal\form_test\EventSubscriber core/modules/system/tests/modules/form_test/src/EventSubscriber/FormTestEventSubscriber.php Test event subscriber to add new attributes to the request. 2
FormTestFileForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestFileForm.php Form constructor for testing #type 'file' elements. 1
FormTestFormStateValuesCleanAdvancedForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanAdvancedForm.php Form builder for \Drupal\Core\Form\FormState::cleanValues() test. 1
FormTestFormStateValuesCleanForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestFormStateValuesCleanForm.php Form builder for \Drupal\Core\Form\FormState::cleanValues() test. 1
FormTestGetForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestGetForm.php Form to test whether GET forms have a CSRF token. 1
FormTestGroupContainerForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestGroupContainerForm.php Builds a simple form to test the #group property on #type 'container'. 1
FormTestGroupDetailsForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestGroupDetailsForm.php Builds a simple form to test the #group property on #type 'details'. 1
FormTestGroupFieldsetForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php Builds a simple form to test the #group property on #type 'fieldset'. 1
FormTestGroupVerticalTabsForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestGroupVerticalTabsForm.php Builds a simple form to test the #group property on #type 'vertical_tabs'. 1
FormTestHooks class Drupal\form_test\Hook core/modules/system/tests/modules/form_test/src/Hook/FormTestHooks.php Hook implementations for form_test.
FormTestInputForgeryForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestInputForgeryForm.php Form to test input forgery. 1
FormTestLabelForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestLabelForm.php A form for testing form labels and required marks. 2 1
FormTestLanguageSelectForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestLanguageSelectForm.php Builds a form to test the language select form element. 1
FormTestLimitValidationErrorsForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestLimitValidationErrorsForm.php Builds a simple form with a button triggering partial validation. 1
FormTestMachineNameForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameForm.php Form constructor for testing #type 'machine_name' elements. 1
FormTestMachineNameValidationForm class Drupal\form_test\Form core/modules/system/tests/modules/form_test/src/Form/FormTestMachineNameValidationForm.php Form to test whether machine name validation works with ajax requests. 1

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.