updated core to 7.73

This commit is contained in:
2020-09-24 17:04:08 +02:00
parent 084d28842a
commit 7d87153100
524 changed files with 25194 additions and 7745 deletions
+342 -116
View File
@@ -84,25 +84,23 @@ function hook_hook_info_alter(&$hooks) {
* Defaults to TRUE.
* - load hook: The name of the hook which should be invoked by
* DrupalDefaultEntityController:attachLoad(), for example 'node_load'.
* - uri callback: A function taking an entity as argument and returning the
* URI elements of the entity, e.g. 'path' and 'options'. The actual entity
* URI can be constructed by passing these elements to url().
* - label callback: (optional) A function taking an entity and an entity type
* as arguments and returning the label of the entity. The entity label is
* the main string associated with an entity; for example, the title of a
* node or the subject of a comment. If there is an entity object property
* that defines the label, use the 'label' element of the 'entity keys'
* return value component to provide this information (see below). If more
* complex logic is needed to determine the label of an entity, you can
* instead specify a callback function here, which will be called to
* determine the entity label. See also the entity_label() function, which
* implements this logic.
* - language callback: (optional) A function taking an entity and an entity
* type as arguments and returning a language code. In most situations, when
* needing to determine this value, inspecting a property named after the
* 'language' element of the 'entity keys' should be enough. The language
* callback is meant to be used primarily for temporary alterations of the
* property value: entity-defining modules are encouraged to always define a
* - uri callback: The name of an implementation of
* callback_entity_info_uri().
* - label callback: (optional) The name of an implementation of
* callback_entity_info_label(), which returns the label of the entity. The
* entity label is the main string associated with an entity; for example,
* the title of a node or the subject of a comment. If there is an entity
* object property that defines the label, then using the 'label' element of
* the 'entity keys' return value component suffices to provide this
* information (see below). Alternatively, specifying this callback allows
* more complex logic to determine the label of an entity. See also the
* entity_label() function, which implements this logic.
* - language callback: (optional) The name of an implementation of
* callback_entity_info_language(). In most situations, when needing to
* determine this value, inspecting a property named after the 'language'
* element of the 'entity keys' should be enough. The language callback is
* meant to be used primarily for temporary alterations of the property
* value: entity-defining modules are encouraged to always define a
* language property, instead of using the callback as main entity language
* source. In fact not having a language property defined is likely to
* prevent an entity from being queried by language. Moreover, given that
@@ -115,21 +113,21 @@ function hook_hook_info_alter(&$hooks) {
* translation handlers. Array keys are the module names, array values
* can be any data structure the module uses to provide field translation.
* Any empty value disallows the module to appear as a translation handler.
* - entity keys: An array describing how the Field API can extract the
* information it needs from the objects of the type. Elements:
* - entity keys: (optional) An array describing how the Field API can extract
* the information it needs from the objects of the type. Elements:
* - id: The name of the property that contains the primary id of the
* entity. Every entity object passed to the Field API must have this
* property and its value must be numeric.
* - revision: The name of the property that contains the revision id of
* the entity. The Field API assumes that all revision ids are unique
* across all entities of a type. This entry can be omitted if the
* entities of this type are not versionable.
* entities of this type are not versionable. Defaults to an empty string.
* - bundle: The name of the property that contains the bundle name for the
* entity. The bundle name defines which set of fields are attached to
* the entity (e.g. what nodes call "content type"). This entry can be
* omitted if this entity type exposes a single bundle (all entities have
* the same collection of fields). The name of this single bundle will be
* the same as the entity type.
* the same as the entity type. Defaults to an empty string.
* - label: The name of the property that contains the entity label. For
* example, if the entity's label is located in $entity->subject, then
* 'subject' should be specified here. If complex logic is required to
@@ -249,7 +247,7 @@ function hook_entity_info() {
'custom settings' => FALSE,
),
'search_result' => array(
'label' => t('Search result'),
'label' => t('Search result highlighting input'),
'custom settings' => FALSE,
),
);
@@ -608,11 +606,13 @@ function hook_cron() {
* @return
* An associative array where the key is the queue name and the value is
* again an associative array. Possible keys are:
* - 'worker callback': The name of the function to call. It will be called
* with one argument, the item created via DrupalQueue::createItem() in
* hook_cron().
* - 'worker callback': The name of an implementation of
* callback_queue_worker().
* - 'time': (optional) How much time Drupal should spend on calling this
* worker in seconds. Defaults to 15.
* - 'skip on cron': (optional) Set to TRUE to avoid being processed during
* cron runs (for example, if you want to control all queue execution
* manually).
*
* @see hook_cron()
* @see hook_cron_queue_info_alter()
@@ -709,9 +709,10 @@ function hook_element_info_alter(&$type) {
/**
* Perform cleanup tasks.
*
* This hook is run at the end of each page request. It is often used for
* page logging and specialized cleanup. This hook MUST NOT print anything
* because by the time it runs the response is already sent to the browser.
* This hook is run at the end of most regular page requests. It is often
* used for page logging and specialized cleanup. This hook MUST NOT print
* anything because by the time it runs the response is already sent to
* the browser.
*
* Only use this hook if your code must run even for cached page views.
* If you have code which must run once on all non-cached pages, use
@@ -874,7 +875,7 @@ function hook_css_alter(&$css) {
*
* @see ajax_render()
*/
function hook_ajax_render_alter($commands) {
function hook_ajax_render_alter(&$commands) {
// Inject any new status messages into the content area.
$commands[] = ajax_command_prepend('#block-system-main .content', theme('status_messages'));
}
@@ -958,6 +959,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* paths and whose values are an associative array of properties for each
* path. (The complete list of properties is in the return value section below.)
*
* @section sec_callback_funcs Callback Functions
* The definition for each path may include a page callback function, which is
* invoked when the registered path is requested. If there is no other
* registered path that fits the requested path better, any further path
@@ -982,6 +984,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* $jkl will be 'foo'. Note that this automatic passing of optional path
* arguments applies only to page and theme callback functions.
*
* @subsection sub_callback_arguments Callback Arguments
* In addition to optional path arguments, the page callback and other callback
* functions may specify argument lists as arrays. These argument lists may
* contain both fixed/hard-coded argument values and integers that correspond
@@ -1024,6 +1027,8 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* @endcode
* See @link form_api Form API documentation @endlink for details.
*
* @section sec_path_wildcards Wildcards in Paths
* @subsection sub_simple_wildcards Simple Wildcards
* Wildcards within paths also work with integer substitution. For example,
* your module could register path 'my-module/%/edit':
* @code
@@ -1036,6 +1041,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* with 'foo' and passed to the callback function. Note that wildcards may not
* be used as the first component.
*
* @subsection sub_autoload_wildcards Auto-Loader Wildcards
* Registered paths may also contain special "auto-loader" wildcard components
* in the form of '%mymodule_abc', where the '%' part means that this path
* component is a wildcard, and the 'mymodule_abc' part defines the prefix for a
@@ -1067,6 +1073,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* return FALSE for the path 'node/999/edit' if a node with a node ID of 999
* does not exist. The menu routing system will return a 404 error in this case.
*
* @subsection sub_argument_wildcards Argument Wildcards
* You can also define a %wildcard_to_arg() function (for the example menu
* entry above this would be 'mymodule_abc_to_arg()'). The _to_arg() function
* is invoked to retrieve a value that is used in the path in place of the
@@ -1091,6 +1098,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* are called when the menu system is generating links to related paths, such
* as the tabs for a set of MENU_LOCAL_TASK items.
*
* @section sec_render_tabs Rendering Menu Items As Tabs
* You can also make groups of menu items to be rendered (by default) as tabs
* on a page. To do that, first create one menu item of type MENU_NORMAL_ITEM,
* with your chosen path, such as 'foo'. Then duplicate that menu item, using a
@@ -1789,6 +1797,8 @@ function hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id) {
* the $form_id input matched your module's format for dynamically-generated
* form IDs, and if so, act appropriately.
*
* Third, forms defined in classes can be defined this way.
*
* @param $form_id
* The unique string identifying the desired form.
* @param $args
@@ -1799,19 +1809,22 @@ function hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id) {
* @return
* An associative array whose keys define form_ids and whose values are an
* associative array defining the following keys:
* - callback: The name of the form builder function to invoke. This will be
* used for the base form ID, for example, to target a base form using
* hook_form_BASE_FORM_ID_alter().
* - callback: The callable returning the form array. If it is the name of
* the form builder function then this will be used for the base
* form ID, for example, to target a base form using
* hook_form_BASE_FORM_ID_alter(). Otherwise use the base_form_id key to
* define the base form ID.
* - callback arguments: (optional) Additional arguments to pass to the
* function defined in 'callback', which are prepended to $args.
* - wrapper_callback: (optional) The name of a form builder function to
* invoke before the form builder defined in 'callback' is invoked. This
* wrapper callback may prepopulate the $form array with form elements,
* which will then be already contained in the $form that is passed on to
* the form builder defined in 'callback'. For example, a wrapper callback
* could setup wizard-alike form buttons that are the same for a variety of
* forms that belong to the wizard, which all share the same wrapper
* callback.
* - base_form_id: The base form ID can be specified explicitly. This is
* required when callback is not the name of a function.
* - wrapper_callback: (optional) Any callable to invoke before the form
* builder defined in 'callback' is invoked. This wrapper callback may
* prepopulate the $form array with form elements, which will then be
* already contained in the $form that is passed on to the form builder
* defined in 'callback'. For example, a wrapper callback could setup
* wizard-like form buttons that are the same for a variety of forms that
* belong to the wizard, which all share the same wrapper callback.
*/
function hook_forms($form_id, $args) {
// Simply reroute the (non-existing) $form_id 'mymodule_first_form' to
@@ -1835,6 +1848,15 @@ function hook_forms($form_id, $args) {
'wrapper_callback' => 'mymodule_main_form_wrapper',
);
// Build a form with a static class callback.
$forms['mymodule_class_generated_form'] = array(
// This will call: MyClass::generateMainForm().
'callback' => array('MyClass', 'generateMainForm'),
// The base_form_id is required when the callback is a static function in
// a class. This can also be used to keep newer code backwards compatible.
'base_form_id' => 'mymodule_main_form',
);
return $forms;
}
@@ -1866,8 +1888,8 @@ function hook_boot() {
*
* This hook is not run on cached pages.
*
* To add CSS or JS that should be present on all pages, modules should not
* implement this hook, but declare these files in their .info file.
* To add CSS or JS files that should be present on all pages, modules should
* not implement this hook, but declare these files in their .info file.
*
* @see hook_boot()
*/
@@ -1882,9 +1904,8 @@ function hook_init() {
/**
* Define image toolkits provided by this module.
*
* The file which includes each toolkit's functions must be declared as part of
* the files array in the module .info file so that the registry will find and
* parse it.
* The file which includes each toolkit's functions must be included in this
* hook.
*
* The toolkit's functions must be named image_toolkitname_operation().
* where the operation may be:
@@ -2029,6 +2050,22 @@ function hook_system_theme_info() {
return $themes;
}
/**
* Return additional theme engines provided by modules.
*
* This hook is invoked from _system_rebuild_theme_data() and allows modules to
* register additional theme engines outside of the regular 'themes/engines'
* directories of a Drupal installation.
*
* @return
* An associative array. Each key is the system name of a theme engine and
* each value is the corresponding path to the theme engine's .engine file.
*/
function hook_system_theme_engine_info() {
$theme_engines['izumi'] = drupal_get_path('module', 'mymodule') . '/izumi/izumi.engine';
return $theme_engines;
}
/**
* Alter the information parsed from module and theme .info files
*
@@ -2101,6 +2138,61 @@ function hook_permission() {
);
}
/**
* Provide online user help.
*
* By implementing hook_help(), a module can make documentation available to
* the user for the module as a whole, or for specific paths. Help for
* developers should usually be provided via function header comments in the
* code, or in special API example files.
*
* The page-specific help information provided by this hook appears as a system
* help block on that page. The module overview help information is displayed
* by the Help module. It can be accessed from the page at admin/help or from
* the Modules page.
*
* For detailed usage examples of:
* - Module overview help, see node_help(). Module overview help should follow
* @link https://drupal.org/node/632280 the standard help template. @endlink
* - Page-specific help with simple paths, see dashboard_help().
* - Page-specific help using wildcards in path and $arg, see node_help()
* and block_help().
*
* @param $path
* The router menu path, as defined in hook_menu(), for the help that is
* being requested; e.g., 'admin/people' or 'user/register'. If the router
* path includes a wildcard, then this will appear in $path as %, even if it
* is a named %autoloader wildcard in the hook_menu() implementation; for
* example, node pages would have $path equal to 'node/%' or 'node/%/view'.
* For the help page for the module as a whole, $path will have the value
* 'admin/help#module_name', where 'module_name" is the machine name of your
* module.
* @param $arg
* An array that corresponds to the return value of the arg() function, for
* modules that want to provide help that is specific to certain values
* of wildcards in $path. For example, you could provide help for the path
* 'user/1' by looking for the path 'user/%' and $arg[1] == '1'. This given
* array should always be used rather than directly invoking arg(), because
* your hook implementation may be called for other purposes besides building
* the current page's help. Note that depending on which module is invoking
* hook_help, $arg may contain only empty strings. Regardless, $arg[0] to
* $arg[11] will always be set.
*
* @return
* A localized string containing the help text.
*/
function hook_help($path, $arg) {
switch ($path) {
// Main module help for the block module
case 'admin/help#block':
return '<p>' . t('Blocks are boxes of content rendered into an area, or region, of a web page. The default theme Bartik, for example, implements the regions "Sidebar first", "Sidebar second", "Featured", "Content", "Header", "Footer", etc., and a block may appear in any one of these areas. The <a href="@blocks">blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions.', array('@blocks' => url('admin/structure/block'))) . '</p>';
// Help for another path in the block module
case 'admin/structure/block':
return '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
}
}
/**
* Register a module (or theme's) theme implementations.
*
@@ -2302,7 +2394,7 @@ function hook_theme_registry_alter(&$theme_registry) {
* @return
* The machine-readable name of the theme that should be used for the current
* page request. The value returned from this function will only have an
* effect if it corresponds to a currently-active theme on the site. Do not
* effect if it corresponds to a currently-active theme on the site. Do not
* return a value if you do not wish to set a custom theme.
*/
function hook_custom_theme() {
@@ -2570,6 +2662,8 @@ function hook_flush_caches() {
* module_enable() for a detailed description of the order in which install and
* enable hooks are invoked.
*
* This hook should be implemented in a .module file, not in an .install file.
*
* @param $modules
* An array of the modules that were installed.
*
@@ -2826,7 +2920,15 @@ function hook_file_insert($file) {
* @see file_save()
*/
function hook_file_update($file) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$old_filename = $file->filename;
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', t('%source has been renamed to %destination', array('%source' => $old_filename, '%destination' => $file->filename)));
}
}
/**
@@ -2840,7 +2942,14 @@ function hook_file_update($file) {
* @see file_copy()
*/
function hook_file_copy($file, $source) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', t('Copied file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
}
}
/**
@@ -2854,7 +2963,14 @@ function hook_file_copy($file, $source) {
* @see file_move()
*/
function hook_file_move($file, $source) {
$file_user = user_load($file->uid);
// Make sure that the file name starts with the owner's user name.
if (strpos($file->filename, $file_user->name) !== 0) {
$file->filename = $file_user->name . '_' . $file->filename;
$file->save();
watchdog('file', t('Moved file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
}
}
/**
@@ -3006,8 +3122,9 @@ function hook_file_url_alter(&$uri) {
* status report page.
*
* @return
* A keyed array of requirements. Each requirement is itself an array with
* the following items:
* An associative array where the keys are arbitrary but must be unique (it
* is suggested to use the module short name as a prefix) and the values are
* themselves associative arrays with the following elements:
* - title: The name of the requirement.
* - value: The current value (e.g., version, time, level, etc). During
* install phase, this should only be used for version numbers, do not set
@@ -3069,37 +3186,41 @@ function hook_requirements($phase) {
/**
* Define the current version of the database schema.
*
* A Drupal schema definition is an array structure representing one or
* more tables and their related keys and indexes. A schema is defined by
* A Drupal schema definition is an array structure representing one or more
* tables and their related keys and indexes. A schema is defined by
* hook_schema() which must live in your module's .install file.
*
* This hook is called at install and uninstall time, and in the latter
* case, it cannot rely on the .module file being loaded or hooks being known.
* If the .module file is needed, it may be loaded with drupal_load().
* This hook is called at install and uninstall time, and in the latter case, it
* cannot rely on the .module file being loaded or hooks being known. If the
* .module file is needed, it may be loaded with drupal_load().
*
* The tables declared by this hook will be automatically created when
* the module is first enabled, and removed when the module is uninstalled.
* This happens before hook_install() is invoked, and after hook_uninstall()
* is invoked, respectively.
* The tables declared by this hook will be automatically created when the
* module is first enabled, and removed when the module is uninstalled. This
* happens before hook_install() is invoked, and after hook_uninstall() is
* invoked, respectively.
*
* By declaring the tables used by your module via an implementation of
* hook_schema(), these tables will be available on all supported database
* engines. You don't have to deal with the different SQL dialects for table
* creation and alteration of the supported database engines.
*
* See the Schema API Handbook at http://drupal.org/node/146843 for
* details on schema definition structures.
* See the Schema API Handbook at http://drupal.org/node/146843 for details on
* schema definition structures. Note that foreign key definitions are for
* documentation purposes only; foreign keys are not created in the database,
* nor are they enforced by Drupal.
*
* @return
* @return array
* A schema definition structure array. For each element of the
* array, the key is a table name and the value is a table structure
* definition.
*
* @see hook_schema_alter()
*
* @ingroup schemaapi
*/
function hook_schema() {
$schema['node'] = array(
// example (partial) specification for table "node"
// Example (partial) specification for table "node".
'description' => 'The base table for nodes.',
'fields' => array(
'nid' => array(
@@ -3138,6 +3259,8 @@ function hook_schema() {
'nid_vid' => array('nid', 'vid'),
'vid' => array('vid'),
),
// For documentation purposes only; foreign keys are not created in the
// database.
'foreign keys' => array(
'node_revision' => array(
'table' => 'node_revision',
@@ -3165,6 +3288,8 @@ function hook_schema() {
*
* @param $schema
* Nested array describing the schemas for all modules.
*
* @ingroup schemaapi
*/
function hook_schema_alter(&$schema) {
// Add field to existing schema.
@@ -3336,24 +3461,31 @@ function hook_install() {
* hooks. See @link update_api Update versions of API functions @endlink for
* details.
*
* If your update task is potentially time-consuming, you'll need to implement a
* multipass update to avoid PHP timeouts. Multipass updates use the $sandbox
* parameter provided by the batch API (normally, $context['sandbox']) to store
* information between successive calls, and the $sandbox['#finished'] value
* to provide feedback regarding completion level.
* The $sandbox parameter should be used when a multipass update is needed, in
* circumstances where running the whole update at once could cause PHP to
* timeout. Each pass is run in a way that avoids PHP timeouts, provided each
* pass remains under the timeout limit. To signify that an update requires
* at least one more pass, set $sandbox['#finished'] to a number less than 1
* (you need to do this each pass). The value of $sandbox['#finished'] will be
* unset between passes but all other data in $sandbox will be preserved. The
* system will stop iterating this update when $sandbox['#finished'] is left
* unset or set to a number higher than 1. It is recommended that
* $sandbox['#finished'] is initially set to 0, and then updated each pass to a
* number between 0 and 1 that represents the overall % completed for this
* update, finishing with 1.
*
* See the batch operations page for more information on how to use the
* @link http://drupal.org/node/180528 Batch API. @endlink
* See the @link batch Batch operations topic @endlink for more information on
* how to use the Batch API.
*
* @param $sandbox
* @param array $sandbox
* Stores information for multipass updates. See above for more information.
*
* @throws DrupalUpdateException, PDOException
* @throws DrupalUpdateException|PDOException
* In case of error, update hooks should throw an instance of DrupalUpdateException
* with a meaningful message for the user. If a database query fails for whatever
* reason, it will throw a PDOException.
*
* @return
* @return string|null
* Optionally, update hooks may return a translated string that will be
* displayed to the user after the update has completed. If no message is
* returned, no message will be presented to the user.
@@ -3597,8 +3729,9 @@ function hook_registry_files_alter(&$files, $modules) {
*
* Any tasks you define here will be run, in order, after the installer has
* finished the site configuration step but before it has moved on to the
* final import of languages and the end of the installation. You can have any
* number of custom tasks to perform during this phase.
* final import of languages and the end of the installation. This is invoked
* by install_tasks(). You can have any number of custom tasks to perform
* during this phase.
*
* Each task you define here corresponds to a callback function which you must
* separately define and which is called when your task is run. This function
@@ -3638,66 +3771,61 @@ function hook_registry_files_alter(&$files, $modules) {
* inspect later. It is important to remove any temporary variables using
* variable_del() before your last task has completed and control is handed
* back to the installer.
*
*
* @param array $install_state
* An array of information about the current installation state.
*
* @return
* @return array
* A keyed array of tasks the profile will perform during the final stage of
* the installation. Each key represents the name of a function (usually a
* function defined by this profile, although that is not strictly required)
* that is called when that task is run. The values are associative arrays
* containing the following key-value pairs (all of which are optional):
* - 'display_name'
* The human-readable name of the task. This will be displayed to the
* user while the installer is running, along with a list of other tasks
* that are being run. Leave this unset to prevent the task from
* appearing in the list.
* - 'display'
* This is a boolean which can be used to provide finer-grained control
* over whether or not the task will display. This is mostly useful for
* tasks that are intended to display only under certain conditions; for
* these tasks, you can set 'display_name' to the name that you want to
* display, but then use this boolean to hide the task only when certain
* conditions apply.
* - 'type'
* A string representing the type of task. This parameter has three
* possible values:
* - 'normal': This indicates that the task will be treated as a regular
* callback function, which does its processing and optionally returns
* HTML output. This is the default behavior which is used when 'type' is
* not set.
* - 'batch': This indicates that the task function will return a batch
* API definition suitable for batch_set(). The installer will then take
* care of automatically running the task via batch processing.
* - 'form': This indicates that the task function will return a standard
* - display_name: The human-readable name of the task. This will be
* displayed to the user while the installer is running, along with a list
* of other tasks that are being run. Leave this unset to prevent the task
* from appearing in the list.
* - display: This is a boolean which can be used to provide finer-grained
* control over whether or not the task will display. This is mostly useful
* for tasks that are intended to display only under certain conditions;
* for these tasks, you can set 'display_name' to the name that you want to
* display, but then use this boolean to hide the task only when certain
* conditions apply.
* - type: A string representing the type of task. This parameter has three
* possible values:
* - normal: (default) This indicates that the task will be treated as a
* regular callback function, which does its processing and optionally
* returns HTML output.
* - batch: This indicates that the task function will return a batch API
* definition suitable for batch_set(). The installer will then take care
* of automatically running the task via batch processing.
* - form: This indicates that the task function will return a standard
* form API definition (and separately define validation and submit
* handlers, as appropriate). The installer will then take care of
* automatically directing the user through the form submission process.
* - 'run'
* A constant representing the manner in which the task will be run. This
* parameter has three possible values:
* - INSTALL_TASK_RUN_IF_NOT_COMPLETED: This indicates that the task will
* run once during the installation of the profile. This is the default
* behavior which is used when 'run' is not set.
* - INSTALL_TASK_SKIP: This indicates that the task will not run during
* - run: A constant representing the manner in which the task will be run.
* This parameter has three possible values:
* - INSTALL_TASK_RUN_IF_NOT_COMPLETED: (default) This indicates that the
* task will run once during the installation of the profile.
* - INSTALL_TASK_SKIP: This indicates that the task will not run during
* the current installation page request. It can be used to skip running
* an installation task when certain conditions are met, even though the
* task may still show on the list of installation tasks presented to the
* user.
* - INSTALL_TASK_RUN_IF_REACHED: This indicates that the task will run
* on each installation page request that reaches it. This is rarely
* - INSTALL_TASK_RUN_IF_REACHED: This indicates that the task will run on
* each installation page request that reaches it. This is rarely
* necessary for an installation profile to use; it is primarily used by
* the Drupal installer for bootstrap-related tasks.
* - 'function'
* Normally this does not need to be set, but it can be used to force the
* installer to call a different function when the task is run (rather
* than the function whose name is given by the array key). This could be
* used, for example, to allow the same function to be called by two
* different tasks.
* - function: Normally this does not need to be set, but it can be used to
* force the installer to call a different function when the task is run
* (rather than the function whose name is given by the array key). This
* could be used, for example, to allow the same function to be called by
* two different tasks.
*
* @see install_state_defaults()
* @see batch_set()
* @see hook_install_tasks_alter()
* @see install_tasks()
*/
function hook_install_tasks(&$install_state) {
// Here, we define a variable to allow tasks to indicate that a particular,
@@ -3800,6 +3928,8 @@ function hook_html_head_alter(&$head_elements) {
/**
* Alter the full list of installation tasks.
*
* This hook is invoked on the install profile in install_tasks().
*
* @param $tasks
* An array of all available installation tasks, including those provided by
* Drupal core. You can modify this array to change or replace any part of
@@ -3807,6 +3937,9 @@ function hook_html_head_alter(&$head_elements) {
* is selected.
* @param $install_state
* An array of information about the current installation state.
*
* @see hook_install_tasks()
* @see install_tasks()
*/
function hook_install_tasks_alter(&$tasks, $install_state) {
// Replace the "Choose language" installation task provided by Drupal core
@@ -4071,7 +4204,7 @@ function hook_date_format_types_alter(&$types) {
* declared in an implementation of hook_date_format_types().
* - 'format': A PHP date format string to use when formatting dates. It
* can contain any of the formatting options described at
* http://php.net/manual/en/function.date.php
* http://php.net/manual/function.date.php
* - 'locales': (optional) An array of 2 and 5 character locale codes,
* defining which locales this format applies to (for example, 'en',
* 'en-us', etc.). If your date format is not language-specific, leave this
@@ -4688,6 +4821,99 @@ function hook_filetransfer_info_alter(&$filetransfer_info) {
* @} End of "addtogroup hooks".
*/
/**
* @addtogroup callbacks
* @{
*/
/**
* Work on a single queue item.
*
* Callback for hook_cron_queue_info().
*
* @param $queue_item_data
* The data that was passed to DrupalQueueInterface::createItem() when the
* item was queued.
*
* @throws Exception
* The worker callback may throw an exception to indicate there was a problem.
* The cron process will log the exception, and leave the item in the queue to
* be processed again later.
*
* @see drupal_cron_run()
*/
function callback_queue_worker($queue_item_data) {
$node = node_load($queue_item_data);
$node->title = 'Updated title';
node_save($node);
}
/**
* Return the URI for an entity.
*
* Callback for hook_entity_info().
*
* @param $entity
* The entity to return the URI for.
*
* @return
* An associative array with the following elements:
* - 'path': The URL path for the entity.
* - 'options': (optional) An array of options for the url() function.
* The actual entity URI can be constructed by passing these elements to
* url().
*/
function callback_entity_info_uri($entity) {
return array(
'path' => 'node/' . $entity->nid,
);
}
/**
* Return the label of an entity.
*
* Callback for hook_entity_info().
*
* @param $entity
* The entity for which to generate the label.
* @param $entity_type
* The entity type; e.g., 'node' or 'user'.
*
* @return
* An unsanitized string with the label of the entity.
*
* @see entity_label()
*/
function callback_entity_info_label($entity, $entity_type) {
return empty($entity->title) ? 'Untitled entity' : $entity->title;
}
/**
* Return the language code of the entity.
*
* Callback for hook_entity_info().
*
* The language callback is meant to be used primarily for temporary alterations
* of the property value.
*
* @param $entity
* The entity for which to return the language.
* @param $entity_type
* The entity type; e.g., 'node' or 'user'.
*
* @return
* The language code for the language of the entity.
*
* @see entity_language()
*/
function callback_entity_info_language($entity, $entity_type) {
return $entity->language;
}
/**
* @} End of "addtogroup callbacks".
*/
/**
* @defgroup update_api Update versions of API functions
* @{