Commit a7c55977 authored by xjm's avatar xjm

Issue #2807785 by claudiu.cristea, OwilliwO, mpdonadio, cllamas, klausi, xjm,...

Issue #2807785 by claudiu.cristea, OwilliwO, mpdonadio, cllamas, klausi, xjm, Berdir, Wim Leers, Mile23, daffie, Prashant.c, dawehner, sneha_surve: Move global constants from *.module files into interfaces
parent ce118a00
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
/** /**
* Denotes that a feed's items should never expire. * Denotes that a feed's items should never expire.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\aggregator\FeedStorageInterface::CLEAR_NEVER instead.
*/ */
const AGGREGATOR_CLEAR_NEVER = 0; const AGGREGATOR_CLEAR_NEVER = 0;
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
*/ */
interface FeedStorageInterface extends ContentEntityStorageInterface { interface FeedStorageInterface extends ContentEntityStorageInterface {
/**
* Denotes that a feed's items should never expire.
*/
const CLEAR_NEVER = 0;
/** /**
* Returns the fids of feeds that need to be refreshed. * Returns the fids of feeds that need to be refreshed.
* *
......
...@@ -4,6 +4,20 @@ ...@@ -4,6 +4,20 @@
interface BlockRepositoryInterface { interface BlockRepositoryInterface {
/**
* Return only visible regions.
*
* @see system_region_list()
*/
const REGIONS_VISIBLE = 'visible';
/**
* Return all regions.
*
* @see system_region_list()
*/
const REGIONS_ALL = 'all';
/** /**
* Returns an array of regions and their block entities. * Returns an array of regions and their block entities.
* *
......
...@@ -28,16 +28,25 @@ ...@@ -28,16 +28,25 @@
/** /**
* Anonymous posters cannot enter their contact information. * Anonymous posters cannot enter their contact information.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\comment\CommentInterface::ANONYMOUS_MAYNOT_CONTACT instead.
*/ */
const COMMENT_ANONYMOUS_MAYNOT_CONTACT = 0; const COMMENT_ANONYMOUS_MAYNOT_CONTACT = 0;
/** /**
* Anonymous posters may leave their contact information. * Anonymous posters may leave their contact information.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\comment\CommentInterface::ANONYMOUS_MAY_CONTACT instead.
*/ */
const COMMENT_ANONYMOUS_MAY_CONTACT = 1; const COMMENT_ANONYMOUS_MAY_CONTACT = 1;
/** /**
* Anonymous posters are required to leave their contact information. * Anonymous posters are required to leave their contact information.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\comment\CommentInterface::ANONYMOUS_MUST_CONTACT instead.
*/ */
const COMMENT_ANONYMOUS_MUST_CONTACT = 2; const COMMENT_ANONYMOUS_MUST_CONTACT = 2;
......
...@@ -22,6 +22,21 @@ interface CommentInterface extends ContentEntityInterface, EntityChangedInterfac ...@@ -22,6 +22,21 @@ interface CommentInterface extends ContentEntityInterface, EntityChangedInterfac
*/ */
const PUBLISHED = 1; const PUBLISHED = 1;
/**
* Anonymous posters cannot enter their contact information.
*/
const ANONYMOUS_MAYNOT_CONTACT = 0;
/**
* Anonymous posters may leave their contact information.
*/
const ANONYMOUS_MAY_CONTACT = 1;
/**
* Anonymous posters are required to leave their contact information.
*/
const ANONYMOUS_MUST_CONTACT = 2;
/** /**
* Determines if this comment is a reply to another comment. * Determines if this comment is a reply to another comment.
* *
......
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
/** /**
* Maximum length of menu name as entered by the user. Database length is 32 * Maximum length of menu name as entered by the user.
* and we add a menu- prefix. *
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Use
* \Drupal\Core\Config\Entity\ConfigEntityStorage::MAX_ID_LENGTH because the
* menu name is a configuration entity ID.
*/ */
const MENU_MAX_MENU_NAME_LENGTH_UI = 27; const MENU_MAX_MENU_NAME_LENGTH_UI = 27;
......
...@@ -16,8 +16,20 @@ ...@@ -16,8 +16,20 @@
/** /**
* The machine name for the empty image breakpoint image style option. * The machine name for the empty image breakpoint image style option.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Use
* Drupal\responsive_image\ResponsiveImageStyleInterface::EMPTY_IMAGE
* instead.
*/ */
const RESPONSIVE_IMAGE_EMPTY_IMAGE = '_empty image_'; const RESPONSIVE_IMAGE_EMPTY_IMAGE = '_empty image_';
/**
* The machine name for the original image breakpoint image style option.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Use
* \Drupal\responsive_image\ResponsiveImageStyleInterface::ORIGINAL_IMAGE
* instead.
*/
const RESPONSIVE_IMAGE_ORIGINAL_IMAGE = '_original image_'; const RESPONSIVE_IMAGE_ORIGINAL_IMAGE = '_original image_';
/** /**
......
...@@ -9,6 +9,16 @@ ...@@ -9,6 +9,16 @@
*/ */
interface ResponsiveImageStyleInterface extends ConfigEntityInterface { interface ResponsiveImageStyleInterface extends ConfigEntityInterface {
/**
* The machine name for the empty image breakpoint image style option.
*/
const EMPTY_IMAGE = '_empty image_';
/**
* The machine name for the original image breakpoint image style option.
*/
const ORIGINAL_IMAGE = '_original image_';
/** /**
* Checks if there is at least one mapping defined. * Checks if there is at least one mapping defined.
* *
......
...@@ -30,16 +30,25 @@ ...@@ -30,16 +30,25 @@
/** /**
* New users will be set to the default time zone at registration. * New users will be set to the default time zone at registration.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::TIMEZONE_DEFAULT instead.
*/ */
const DRUPAL_USER_TIMEZONE_DEFAULT = 0; const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
/** /**
* New users will get an empty time zone at registration. * New users will get an empty time zone at registration.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::TIMEZONE_EMPTY instead.
*/ */
const DRUPAL_USER_TIMEZONE_EMPTY = 1; const DRUPAL_USER_TIMEZONE_EMPTY = 1;
/** /**
* New users will select their own timezone at registration. * New users will select their own timezone at registration.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::TIMEZONE_SELECT instead.
*/ */
const DRUPAL_USER_TIMEZONE_SELECT = 2; const DRUPAL_USER_TIMEZONE_SELECT = 2;
...@@ -61,6 +70,9 @@ ...@@ -61,6 +70,9 @@
/** /**
* Return only visible regions. * Return only visible regions.
* *
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\block\BlockRepositoryInterface::REGIONS_VISIBLE instead.
*
* @see system_region_list() * @see system_region_list()
*/ */
const REGIONS_VISIBLE = 'visible'; const REGIONS_VISIBLE = 'visible';
...@@ -68,6 +80,9 @@ ...@@ -68,6 +80,9 @@
/** /**
* Return all regions. * Return all regions.
* *
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\block\BlockRepositoryInterface::REGIONS_ALL instead.
*
* @see system_region_list() * @see system_region_list()
*/ */
const REGIONS_ALL = 'all'; const REGIONS_ALL = 'all';
......
...@@ -7,6 +7,26 @@ ...@@ -7,6 +7,26 @@
*/ */
interface UpdateFetcherInterface { interface UpdateFetcherInterface {
/**
* Project's status cannot be checked.
*/
const NOT_CHECKED = -1;
/**
* No available update data was found for project.
*/
const UNKNOWN = -2;
/**
* There was a failure fetching available update data for this project.
*/
const NOT_FETCHED = -3;
/**
* We need to (re)fetch available update data for this project.
*/
const FETCH_PENDING = -4;
/** /**
* Returns the base of the URL to fetch available update data for a project. * Returns the base of the URL to fetch available update data for a project.
* *
......
...@@ -7,6 +7,31 @@ ...@@ -7,6 +7,31 @@
*/ */
interface UpdateManagerInterface { interface UpdateManagerInterface {
/**
* Project is missing security update(s).
*/
const NOT_SECURE = 1;
/**
* Current release has been unpublished and is no longer available.
*/
const REVOKED = 2;
/**
* Current release is no longer supported by the project maintainer.
*/
const NOT_SUPPORTED = 3;
/**
* Project has a new release available, but it is not a security release.
*/
const NOT_CURRENT = 4;
/**
* Project is up to date.
*/
const CURRENT = 5;
/** /**
* Fetches an array of installed and enabled projects. * Fetches an array of installed and enabled projects.
* *
......
...@@ -16,50 +16,79 @@ ...@@ -16,50 +16,79 @@
use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Site\Settings; use Drupal\Core\Site\Settings;
// These are internally used constants for this code, do not modify. /*
* These are internally used constants for this code, do not modify.
*/
/** /**
* Project is missing security update(s). * Project is missing security update(s).
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::NOT_SECURE instead.
*/ */
const UPDATE_NOT_SECURE = 1; const UPDATE_NOT_SECURE = 1;
/** /**
* Current release has been unpublished and is no longer available. * Current release has been unpublished and is no longer available.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::REVOKED instead.
*/ */
const UPDATE_REVOKED = 2; const UPDATE_REVOKED = 2;
/** /**
* Current release is no longer supported by the project maintainer. * Current release is no longer supported by the project maintainer.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::NOT_SUPPORTED instead.
*/ */
const UPDATE_NOT_SUPPORTED = 3; const UPDATE_NOT_SUPPORTED = 3;
/** /**
* Project has a new release available, but it is not a security release. * Project has a new release available, but it is not a security release.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::NOT_CURRENT instead.
*/ */
const UPDATE_NOT_CURRENT = 4; const UPDATE_NOT_CURRENT = 4;
/** /**
* Project is up to date. * Project is up to date.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateManagerInterface::CURRENT instead.
*/ */
const UPDATE_CURRENT = 5; const UPDATE_CURRENT = 5;
/** /**
* Project's status cannot be checked. * Project's status cannot be checked.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::NOT_CHECKED instead.
*/ */
const UPDATE_NOT_CHECKED = -1; const UPDATE_NOT_CHECKED = -1;
/** /**
* No available update data was found for project. * No available update data was found for project.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::UNKNOWN instead.
*/ */
const UPDATE_UNKNOWN = -2; const UPDATE_UNKNOWN = -2;
/** /**
* There was a failure fetching available update data for this project. * There was a failure fetching available update data for this project.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::NOT_FETCHED instead.
*/ */
const UPDATE_NOT_FETCHED = -3; const UPDATE_NOT_FETCHED = -3;
/** /**
* We need to (re)fetch available update data for this project. * We need to (re)fetch available update data for this project.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\update\UpdateFetcherInterface::FETCH_PENDING instead.
*/ */
const UPDATE_FETCH_PENDING = -4; const UPDATE_FETCH_PENDING = -4;
......
...@@ -13,6 +13,44 @@ ...@@ -13,6 +13,44 @@
*/ */
interface UserInterface extends ContentEntityInterface, EntityChangedInterface, AccountInterface { interface UserInterface extends ContentEntityInterface, EntityChangedInterface, AccountInterface {
/**
* Maximum length of username text field.
*
* Keep this under 191 characters so we can use a unique constraint in MySQL.
*/
const USERNAME_MAX_LENGTH = 60;
/**
* Only administrators can create user accounts.
*/
const REGISTER_ADMINISTRATORS_ONLY = 'admin_only';
/**
* Visitors can create their own accounts.
*/
const REGISTER_VISITORS = 'visitors';
/**
* Visitors can create accounts, but they don't become active without
* administrative approval.
*/
const REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL = 'visitors_admin_approval';
/**
* New users will be set to the default time zone at registration.
*/
const TIMEZONE_DEFAULT = 0;
/**
* New users will get an empty time zone at registration.
*/
const TIMEZONE_EMPTY = 1;
/**
* New users will select their own timezone at registration.
*/
const TIMEZONE_SELECT = 2;
/** /**
* Whether a user has a certain role. * Whether a user has a certain role.
* *
......
...@@ -28,22 +28,35 @@ ...@@ -28,22 +28,35 @@
* Maximum length of username text field. * Maximum length of username text field.
* *
* Keep this under 191 characters so we can use a unique constraint in MySQL. * Keep this under 191 characters so we can use a unique constraint in MySQL.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::USERNAME_MAX_LENGTH instead.
*/ */
const USERNAME_MAX_LENGTH = 60; const USERNAME_MAX_LENGTH = 60;
/** /**
* Only administrators can create user accounts. * Only administrators can create user accounts.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::REGISTER_ADMINISTRATORS_ONLY instead.
*/ */
const USER_REGISTER_ADMINISTRATORS_ONLY = 'admin_only'; const USER_REGISTER_ADMINISTRATORS_ONLY = 'admin_only';
/** /**
* Visitors can create their own accounts. * Visitors can create their own accounts.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::REGISTER_VISITORS instead.
*/ */
const USER_REGISTER_VISITORS = 'visitors'; const USER_REGISTER_VISITORS = 'visitors';
/** /**
* Visitors can create accounts, but they don't become active without * Visitors can create accounts, but they don't become active without
* administrative approval. * administrative approval.
*
* @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
* Use \Drupal\user\UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL
* instead.
*/ */
const USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL = 'visitors_admin_approval'; const USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL = 'visitors_admin_approval';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment