theme

Drupal. theme

Source:
Generates the themed representation of a Drupal object. All requests for themed output must go through this function. It examines the request and routes it to the appropriate theme function. If the current theme does not provide an override function, the generic theme function is called.

Example

To retrieve the HTML for text that should be emphasized and displayed as a placeholder inside a sentence.

Drupal.theme('placeholder', text);

Methods

(static) ajaxProgressBar($element) → {string}

Source:
Provide a wrapper for the AJAX progress bar element.
Parameters:
Name Type Description
$element jQuery Progress bar element.
Returns:
The HTML markup for the progress bar.
Type
string

(static) ajaxProgressIndicatorFullscreen() → {string}

Source:
An animated progress throbber and container element for AJAX operations.
Returns:
The HTML markup for the throbber.
Type
string

(static) ajaxProgressMessage(message) → {string}

Source:
Formats text accompanying the AJAX progress throbber.
Parameters:
Name Type Description
message string The message shown on the UI.
Returns:
The HTML markup for the throbber.
Type
string

(static) ajaxProgressThrobber(messageopt) → {string}

Source:
An animated progress throbber and container element for AJAX operations.
Parameters:
Name Type Attributes Description
message string <optional>
(optional) The message shown on the UI.
Returns:
The HTML markup for the throbber.
Type
string

(static) ajaxWrapperMultipleRootElements($elements)

Source:
Deprecated:
  • in drupal:8.6.0 and is removed from drupal:10.0.0. Use data with desired wrapper.
See:
To Do:
  • Add deprecation warning after it is possible. For more information see: https://www.drupal.org/project/drupal/issues/2973400
Provide a wrapper for multiple root elements via Ajax.
Parameters:
Name Type Description
$elements jQuery Response elements after parsing.

(static) ajaxWrapperNewContent($newContent, ajax, response)

Source:
Deprecated:
  • in drupal:8.6.0 and is removed from drupal:10.0.0. Use data with desired wrapper.
See:
To Do:
  • Add deprecation warning after it is possible. For more information see: https://www.drupal.org/project/drupal/issues/2973400
Provide a wrapper for new content via Ajax. Wrap the inserted markup when inserting multiple root elements with an ajax effect.
Parameters:
Name Type Description
$newContent jQuery Response elements after parsing.
ajax Drupal.Ajax Drupal.Ajax object created by Drupal.ajax.
response object The response from the Ajax request.

(static) checkbox() → {string}

Source:
Theme function for a checkbox.
Returns:
The HTML markup for the checkbox.
Type
string

(static) detailsSummarizedContentText(textopt) → {string}

Source:
Formats the summarized details content text.
Parameters:
Name Type Attributes Description
text string | null <optional>
(optional) The summarized content text displayed in the summary.
Returns:
The formatted summarized content text.
Type
string

(static) detailsSummarizedContentWrapper() → {string}

Source:
The element containing a wrapper for summarized details content.
Returns:
The markup for the element that will contain the summarized content.
Type
string

(static) message(message, options) → {HTMLElement}

Source:
Theme function for a message.
Parameters:
Name Type Description
message object The message object.
Properties
Name Type Description
text string The message text.
options object The message context.
Properties
Name Type Description
type string The message type.
id string ID of the message, for reference.
Returns:
A DOM Node.
Type
HTMLElement

(static) placeholder(str) → {string}

Source:
Formats text for emphasized display in a placeholder inside a sentence.
Parameters:
Name Type Description
str string The text to format (plain-text).
Returns:
The formatted text (html).
Type
string

(static) progressBar(id) → {string}

Source:
Theme function for the progress bar.
Parameters:
Name Type Description
id string The id for the progress bar.
Returns:
The HTML for the progress bar.
Type
string

(static) tableDragChangedMarker() → {string}

Source:
Returns:
Markup for the marker.
Type
string

(static) tableDragChangedWarning() → {string}

Source:
Returns:
Markup for the warning.
Type
string

(static) tableDragHandle() → {string}

Source:
Returns:
HTML markup for a tableDrag handle.
Type
string

(static) tableDragIndentation() → {string}

Source:
Returns:
Markup for the indentation.
Type
string

(static) tableDragToggle() → {string}

Source:
The button for toggling table row weight visibility.
Returns:
HTML markup for the weight toggle button and its container.
Type
string

(static) toggleButtonContent(show) → {string}

Source:
The contents of the toggle weight button.
Parameters:
Name Type Description
show boolean If the table weights are currently displayed.
Returns:
HTML markup for the weight toggle button content.s
Type
string

(static) verticalTab(settings) → {object}

Source:
Theme function for a vertical tab.
Parameters:
Name Type Description
settings object An object with the following keys:
Properties
Name Type Description
title string The name of the tab.
Returns:
This function has to return an object with at least these keys: - item: The root tab jQuery element - link: The anchor tag that acts as the clickable area of the tab (jQuery version) - summary: The jQuery element that contains the tab summary
Type
object