Classes, traits, and interfaces - 10.3.x - 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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
Connection class Drupal\Driver\Database\fake core/tests/fixtures/database_drivers/custom/fake/Connection.php A fake Connection class for testing purposes. 3 3
Connection

in drupal:9.4.0 and is removed from drupal:11.0.0. The SQLite database driver has been moved to the sqlite module.

class Drupal\Core\Database\Driver\sqlite core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php SQLite implementation of \Drupal\Core\Database\Connection. 1
Connection

in drupal:9.4.0 and is removed from drupal:11.0.0. The MySQL database driver has been moved to the mysql module.

class Drupal\Core\Database\Driver\mysql core/lib/Drupal/Core/Database/Driver/mysql/Connection.php MySQL implementation of \Drupal\Core\Database\Connection. 1
Connection

in drupal:9.4.0 and is removed from drupal:11.0.0. The PostgreSQL database driver has been moved to the pgsql module.

class Drupal\Core\Database\Driver\pgsql core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php PostgreSQL implementation of \Drupal\Core\Database\Connection. 1
Connection abstract class Drupal\Core\Database core/lib/Drupal/Core/Database/Connection.php Base Database API class. 5 137 3
Connection class Drupal\mysql\Driver\Database\mysql core/modules/mysql/src/Driver/Database/mysql/Connection.php MySQL implementation of \Drupal\Core\Database\Connection. 4 8
Connection class Drupal\sqlite\Driver\Database\sqlite core/modules/sqlite/src/Driver/Database/sqlite/Connection.php SQLite implementation of \Drupal\Core\Database\Connection. 2 8
ConnectionFailureTest class Drupal\Tests\dblog\Kernel core/modules/dblog/tests/src/Kernel/ConnectionFailureTest.php Tests logging of connection failures.
ConnectionNotDefinedException class Drupal\Core\Database core/lib/Drupal/Core/Database/ConnectionNotDefinedException.php Exception thrown if an undefined database connection is requested. 7
ConnectionTest class Drupal\Tests\Core\Database core/tests/Drupal/Tests/Core/Database/ConnectionTest.php Tests the Connection class.
ConnectionTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php Tests of the core database system.
ConnectionTest class Drupal\Tests\sqlite\Unit core/modules/sqlite/tests/src/Unit/ConnectionTest.php @coversDefaultClass \Drupal\sqlite\Driver\Database\sqlite\Connection @group Database
ConnectionTest class Drupal\Tests\sqlite\Kernel\sqlite core/modules/sqlite/tests/src/Kernel/sqlite/ConnectionTest.php SQLite-specific connection tests.
ConnectionTest class Drupal\Tests\mysql\Unit core/modules/mysql/tests/src/Unit/ConnectionTest.php Tests MySQL database connections.
ConnectionTest class Drupal\Tests\mysql\Kernel\mysql core/modules/mysql/tests/src/Kernel/mysql/ConnectionTest.php MySQL-specific connection tests.
ConnectionUnitTest class Drupal\Tests\mysql\Kernel\mysql core/modules/mysql/tests/src/Kernel/mysql/ConnectionUnitTest.php MySQL-specific connection unit tests.
ConnectionUnitTest class Drupal\Tests\pgsql\Kernel\pgsql core/modules/pgsql/tests/src/Kernel/pgsql/ConnectionUnitTest.php PostgreSQL-specific connection unit tests.
Constraint class Drupal\Core\Validation\Attribute core/lib/Drupal/Core/Validation/Attribute/Constraint.php Defines a Constraint attribute object. 85
Constraint class Drupal\Core\Validation\Annotation core/lib/Drupal/Core/Validation/Annotation/Constraint.php Defines a validation constraint annotation object.
Constraint class Drupal\Component\Version core/lib/Drupal/Component/Version/Constraint.php A value object representing a Drupal version constraint. 3
ConstraintFactory class Drupal\Core\Validation core/lib/Drupal/Core/Validation/ConstraintFactory.php Constraint plugin factory.
ConstraintFactoryTest class Drupal\KernelTests\Core\Validation core/tests/Drupal/KernelTests/Core/Validation/ConstraintFactoryTest.php @coversDefaultClass \Drupal\Core\Validation\ConstraintFactory
ConstraintManager class Drupal\Core\Validation core/lib/Drupal/Core/Validation/ConstraintManager.php Constraint plugin manager. 8 2
ConstraintsTest class Drupal\KernelTests\Core\Validation core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php Tests various low level constrains provided by core.
ConstraintTest class Drupal\Tests\Component\Version core/tests/Drupal/Tests/Component/Version/ConstraintTest.php @coversDefaultClass \Drupal\Component\Version\Constraint @group Version
ConstraintValidatorFactory class Drupal\Core\Validation core/lib/Drupal/Core/Validation/ConstraintValidatorFactory.php Defines a constraint validator factory that works with container injection. 2
ConstraintViolationBuilder class Drupal\Core\Validation core/lib/Drupal/Core/Validation/ConstraintViolationBuilder.php A constraint violation builder for the basic Symfony validator. 1 1
ConstraintViolationBuilder class Drupal\Core\TypedData\Validation core/lib/Drupal/Core/TypedData/Validation/ConstraintViolationBuilder.php Defines a constraint violation builder for the Typed Data validator.
ContactCategory class Drupal\contact\Plugin\migrate\source core/modules/contact/src/Plugin/migrate/source/ContactCategory.php Drupal 6/7 contact category source from database.
ContactCategoryTest class Drupal\Tests\contact\Kernel\Plugin\migrate\source core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php Tests D6 contact category source plugin.
ContactController class Drupal\contact\Controller core/modules/contact/src/Controller/ContactController.php Controller routines for contact routes.
ContactFieldsTest class Drupal\Tests\contact\Kernel\Views core/modules/contact/tests/src/Kernel/Views/ContactFieldsTest.php Tests that no storage is created for the contact_message entity.
ContactForm class Drupal\contact\Entity core/modules/contact/src/Entity/ContactForm.php Defines the contact form entity. 15
ContactFormAccessControlHandler class Drupal\contact core/modules/contact/src/ContactFormAccessControlHandler.php Defines the access control handler for the contact form entity type.
ContactFormEditForm class Drupal\contact core/modules/contact/src/ContactFormEditForm.php Base form for contact form edit forms.
ContactFormInterface interface Drupal\contact core/modules/contact/src/ContactFormInterface.php Provides an interface defining a contact form entity. 1 5
ContactFormJsonAnonTest class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormJsonAnonTest.php @group rest
ContactFormJsonBasicAuthTest class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormJsonBasicAuthTest.php @group rest
ContactFormJsonCookieTest class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormJsonCookieTest.php @group rest
ContactFormListBuilder class Drupal\contact core/modules/contact/src/ContactFormListBuilder.php Defines a class to build a listing of contact form entities.
ContactFormResourceTestBase abstract class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormResourceTestBase.php 6
ContactFormTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/ContactFormTest.php JSON:API integration test for the "ContactForm" config entity type.
ContactFormValidationTest class Drupal\Tests\contact\Kernel core/modules/contact/tests/src/Kernel/ContactFormValidationTest.php Tests validation of contact_form entities.
ContactFormXmlAnonTest class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormXmlAnonTest.php @group rest
ContactFormXmlBasicAuthTest class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormXmlBasicAuthTest.php @group rest
ContactFormXmlCookieTest class Drupal\Tests\contact\Functional\Rest core/modules/contact/tests/src/Functional/Rest/ContactFormXmlCookieTest.php @group rest
ContactLanguageTest class Drupal\Tests\contact\Functional core/modules/contact/tests/src/Functional/ContactLanguageTest.php Tests contact messages with language module.
ContactLink class Drupal\contact\Plugin\views\field core/modules/contact/src/Plugin/views/field/ContactLink.php Defines a field that links to the user contact page, if access is permitted. 1
ContactLinkTest class Drupal\Tests\contact\Unit core/modules/contact/tests/src/Unit/ContactLinkTest.php @coversDefaultClass \Drupal\contact\Plugin\views\field\ContactLink @group contact
ContactLinkTest class Drupal\Tests\contact\Functional\Views core/modules/contact/tests/src/Functional/Views/ContactLinkTest.php Tests the contact link field.

Other projects


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