W3cubDocs

/Drupal 8

common.inc

Common functions that many Drupal modules will need to reference.

The functions that are critical and need to be available even when serving a cached page are instead located in bootstrap.inc.

File

core/includes/common.inc

Functions

Name Description
archiver_get_archiver Creates the appropriate archiver for the specified file.
archiver_get_extensions Returns a string of supported archive extensions.
base_path Returns the base URL path (i.e., directory) of the Drupal installation.
check_url Deprecated Strips dangerous protocols from a URI and encodes it for output to HTML.
date_iso8601 Returns an ISO8601 formatted date based on the given date.
debug Outputs debug information.
drupal_attach_tabledrag Assists in attaching the tableDrag JavaScript behavior to a themed table.
drupal_check_incompatibility Checks whether a version is compatible with a given dependency.
drupal_clear_css_cache Deprecated Deletes old cached CSS files.
drupal_clear_js_cache Deprecated Deletes old cached JavaScript files and variables.
drupal_flush_all_caches Flushes all persistent caches, resets all variables, and rebuilds all data structures.
drupal_get_destination Deprecated Prepares a 'destination' URL query parameter.
drupal_get_filetransfer_info Assembles the Drupal FileTransfer registry.
drupal_get_updaters Assembles the Drupal Updater registry.
drupal_http_header_attributes Formats an attribute string for an HTTP header.
drupal_js_defaults Constructs an array of the defaults that are used for JavaScript assets.
drupal_pre_render_link Deprecated Pre-render callback: Renders a link into #markup.
drupal_pre_render_links Pre-render callback: Collects child links into a single array.
drupal_process_states Adds JavaScript to change the state of an element based on another element.
drupal_render Deprecated Renders HTML given a structured array tree.
drupal_render_children Deprecated Renders children of an element and concatenates them.
drupal_render_root Deprecated Renders final HTML given a structured array tree.
drupal_set_time_limit Attempts to set the PHP maximum execution time.
element_info Deprecated Retrieves the default properties for the defined element type.
element_info_property Deprecated Retrieves a single property for the defined element type.
format_date Deprecated Formats a date, using a date type or a custom date format string.
format_size Generates a string representation for the given byte count.
hide Hides an element from later rendering.
render Renders an element.
show Shows a hidden element for later rendering.
valid_email_address Deprecated Verifies the syntax of the given email address.
_drupal_flush_css_js Changes the dummy query string added to all CSS and JavaScript files.

Constants

Name Description
CSS_AGGREGATE_DEFAULT The default aggregation group for CSS files added to the page.
CSS_AGGREGATE_THEME The default aggregation group for theme CSS files added to the page.
CSS_BASE The default weight for CSS rules that style HTML elements ("base" styles).
CSS_COMPONENT The default weight for CSS rules that style design components (and their associated states and themes.)
CSS_LAYOUT The default weight for CSS rules that layout a page.
CSS_STATE The default weight for CSS rules that style states and are not included with components.
CSS_THEME The default weight for CSS rules that style themes and are not included with components.
JS_DEFAULT The default group for module JavaScript code added to the page.
JS_LIBRARY The default group for JavaScript and jQuery libraries added to the page.
JS_SETTING The default group for JavaScript settings added to the page.
JS_THEME The default group for theme JavaScript code added to the page.
LOCALE_PLURAL_DELIMITER Deprecated The delimiter used to split plural strings.
SAVED_DELETED Return status for saving which deleted an existing item.
SAVED_NEW Return status for saving which involved creating a new item.
SAVED_UPDATED Return status for saving which involved an update to an existing item.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!common.inc/8.1.x