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

Name Type Namespace Location Description Direct uses Use statementssort ascending Strings
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. 2 650
Url class Drupal\Core core/lib/Drupal/Core/Url.php Defines an object that holds information about a URL. 617
UnitTestCase abstract class Drupal\Tests core/tests/Drupal/Tests/UnitTestCase.php Provides a base class and helpers for Drupal unit tests. 594 592
AccountInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/AccountInterface.php Defines an account interface which represents the current user. 2 277
EntityInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityInterface.php Defines a common interface for all entity objects. 11 266
EntityTypeManagerInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php Provides an interface for entity type managers. 262
Views class Drupal\views core/modules/views/src/Views.php Static service container wrapper for views. 250
Row class Drupal\migrate core/modules/migrate/src/Row.php Stores a row. 217
Database abstract class Drupal\Core\Database core/lib/Drupal/Core/Database/Database.php Primary front-controller for the database system. 214
LanguageInterface interface Drupal\Core\Language core/lib/Drupal/Core/Language/LanguageInterface.php Defines an interface for languages. 2 203
ConfigurableLanguage class Drupal\language\Entity core/modules/language/src/Entity/ConfigurableLanguage.php Defines the ConfigurableLanguage entity. 200
EntityTypeInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeInterface.php Provides an interface for an entity type and its metadata. 3 200
RouteMatchInterface interface Drupal\Core\Routing core/lib/Drupal/Core/Routing/RouteMatchInterface.php Provides an interface for classes representing the result of routing. 3 196
Node class Drupal\node\Entity core/modules/node/src/Entity/Node.php Defines the node entity class. 182
AccessResult abstract class Drupal\Core\Access core/lib/Drupal/Core/Access/AccessResult.php Value object for passing an access result with cacheability metadata. 3 166
Cache class Drupal\Core\Cache core/lib/Drupal/Core/Cache/Cache.php Helper methods for cache. 162
NodeType class Drupal\node\Entity core/modules/node/src/Entity/NodeType.php Defines the Node type configuration entity. 158
FieldStorageDefinitionInterface interface Drupal\Core\Field core/lib/Drupal/Core/Field/FieldStorageDefinitionInterface.php Defines an interface for entity field storage definitions. 3 152
ModuleHandlerInterface interface Drupal\Core\Extension core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php Interface for classes that manage a set of enabled modules. 1 150
Html class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Html.php Provides DOMDocument helpers for parsing and serializing HTML strings. 146
WebDriverTestBase abstract class Drupal\FunctionalJavascriptTests core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php Runs a browser test using a driver that supports JavaScript. 150 145
ContainerBuilder class Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php Drupal's dependency injection container builder. 144
XmlEntityNormalizationQuirksTrait trait Drupal\Tests\rest\Functional\EntityResource core/modules/rest/tests/src/Functional/EntityResource/XmlEntityNormalizationQuirksTrait.php Trait for EntityResourceTestBase subclasses testing $format='xml'. 144
EntityTest class Drupal\entity_test\Entity core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php Defines the test entity class. 35 143
FormBase abstract class Drupal\Core\Form core/lib/Drupal/Core/Form/FormBase.php Provides a base class for forms. 144 142
MigrationInterface interface Drupal\migrate\Plugin core/modules/migrate/src/Plugin/MigrationInterface.php Interface for migrations. 1 138
CacheableMetadata class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableMetadata.php Defines a generic class for passing cacheability metadata. 2 130
StringTranslationTrait trait Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface. 127
TranslatableMarkup class Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php Provides translatable markup class. 2 112
ViewsKernelTestBase abstract class Drupal\Tests\views\Kernel core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php Defines a base class for Views kernel testing. 127 111
Settings final class Drupal\Core\Site core/lib/Drupal/Core/Site/Settings.php Read only settings that are initialized with the class. 109 2
EntityStorageInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityStorageInterface.php Defines the interface for entity storage classes. 6 109
ConfigFactoryInterface interface Drupal\Core\Config core/lib/Drupal/Core/Config/ConfigFactoryInterface.php Defines the interface for a configuration object factory. 1 108
MigrateDrupal6TestBase abstract class Drupal\Tests\migrate_drupal\Kernel\d6 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php Base class for Drupal 6 migration tests. 111 105
AnonResourceTestTrait trait Drupal\Tests\rest\Functional core/modules/rest/tests/src/Functional/AnonResourceTestTrait.php Defines a trait for testing with no authentication provider. 104
RoleInterface interface Drupal\user core/modules/user/src/RoleInterface.php Provides an interface defining a user role entity. 1 99
MigrateSqlSourceTestBase abstract class Drupal\Tests\migrate\Kernel core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php Base class for tests of Migrate source plugins that use a database. 99 98
MigrateDrupal7TestBase abstract class Drupal\Tests\migrate_drupal\Kernel\d7 core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7TestBase.php Base class for Drupal 7 migration tests. 103 98
BasicAuthResourceTestTrait trait Drupal\Tests\rest\Functional core/modules/rest/tests/src/Functional/BasicAuthResourceTestTrait.php Trait for ResourceTestBase subclasses testing $auth=basic_auth. 98
FormattableMarkup class Drupal\Component\Render core/lib/Drupal/Component/Render/FormattableMarkup.php Formats a string for HTML display by replacing variable placeholders. 1 97
Role class Drupal\user\Entity core/modules/user/src/Entity/Role.php Defines the user role entity class. 97
CookieResourceTestTrait trait Drupal\Tests\rest\Functional core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php Trait for ResourceTestBase subclasses testing $auth=cookie. 97
Json class Drupal\Component\Serialization core/lib/Drupal/Component/Serialization/Json.php Default serialization for JSON. 96 3
File class Drupal\file\Entity core/modules/file/src/Entity/File.php Defines the file entity class. 95
Element class Drupal\Core\Render core/lib/Drupal/Core/Render/Element.php Provides helper methods for Drupal render elements. 92
MigrateExecutableInterface interface Drupal\migrate core/modules/migrate/src/MigrateExecutableInterface.php 1 91
FieldDefinitionInterface interface Drupal\Core\Field core/lib/Drupal/Core/Field/FieldDefinitionInterface.php Defines an interface for entity field definitions. 5 91
NestedArray class Drupal\Component\Utility core/lib/Drupal/Component/Utility/NestedArray.php Provides helpers to perform operations on nested arrays and array keys of variable depth. 90
CacheBackendInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheBackendInterface.php Defines an interface for cache implementations. 5 88 27
BaseFieldDefinition class Drupal\Core\Field core/lib/Drupal/Core/Field/BaseFieldDefinition.php A class for defining entity fields. 2 87

Pages

Other projects