Helpers (base) Functions

Functions

test_empty_string($string, $test = '')

Test if a string is empty, or equals another string. If so, return a themed empty placeholder. Else return the input string.

  • Calling parameters
  • $string
    The string we want to test to find out if it's empty;
    $test
    Optional string to test against; this is in case you want to redefine "empty."
  • Return
  • themed empty placeholder or the input string

format_shorten_string($string, $length = 15, $count_addition = 3)

Formats a chopped off string of a certain length. Calls a themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look. function to do the actual formatting. By default it will return strings in the form of "verylongstringwithsomecoo..."

  • Calling parameters
  • $string
    the original string.
    $count_addition
    Optional, provides an amount for the additional characters. Giving this parameter, for example a value of 5, you will receive a shortened string in the form of "verylongstringwithsomec....."
  • Return
  • the shortened string

void_page()

Render nothing - a blank page.

Menu items
helpers/void
  • Calling parameters
  • None
  • Return
  • Blank page.

get_block($name, $delta = 0)

Get a block as object prepared to use in the themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._block function.

  • $name the modulename (block name) to get the block from.
  • $delta the block delta. Each block in each moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP. has a unique delta value. A number indicating that block.
    • Calling parameters
    • $name
      the name of the moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP. providing the block.
      $delta
      the block delta. Each block in each moduleAn add-on, or extension, to Drupal to provide additional functionality; written in PHP. has a unique delta value, which is (usually) a number indicating the block.
    • Return
    • An object containing the information about the block.

    user_has_role($user, $roles)

    Find out if a user has a certain role or roles. This is not the same as "user_access."

    • Calling parameters
    • $user
      a user object, which must contain the $user->roles array such as would be provided from "user_load."
      $roles
      an array of roles to check for.
    • Return
    • TRUE
      if the user has a role you checked for.
      FALSE
      if the user is not within any of the requested roles.

    ThemeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look. Functions

    themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._empty_placeholder($message = NULL)

    ThemeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look. an "empty" placeholder.

    • Calling parameters
    • $message
      Optional. Provide a translated message string.
    • Return
    • a string that can be used as placeholder for non existing content. Defaults to a translated "not available."

    themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._read_more($path, $title = NULL)

    Function to consistently themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look. "read more" links. Core patch pending at http://drupal.org/node/69571

    • Calling parameters
    • $path
      a drupal

      Drupal

      An open-source content management system that is used on this site and is taking over the world.
      path or full url to the full resource. Include http:// if you linkThe technique which points to another page, anywhere on the Internet, from the current page. to external resource.
      $title
      an optional title that will provide a tooltip text when hovering over the linkThe technique which points to another page, anywhere on the Internet, from the current page..
    • Return
    • An HTMLHyperText Markup Language - the coding standard for a web page. string to display as the "read more" linkThe technique which points to another page, anywhere on the Internet, from the current page..

    themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._definition_list($items = array(), $title = NULL, $filter = TRUE)

    Return a themed list of definition items. Core patch pending at http://drupal.org/node/54898

    • Calling parameters
    • $items
      An array of items to be displayed in the list.

    • The argument is: array("term" => $term, "definitions" => $definitions)
    • If you provide the $definition as arrays, you will get multiple DDs with each DT.
    • If you provide the $definitions as a string, only one DD will be added to the DT.
    • $title
      The title of the list.
      $filter
      Boolean value to define whether or not you wish to filter the input. Should be left TRUE, unless you sanitize the input yourself.
    • Return
    • An HTMLHyperText Markup Language - the coding standard for a web page. string containing the list output.

    themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._name_and_value_pair($name, $value, $filter = TRUE)

    Return a themed name and value as a DT DD pair.

    • Calling parameters
    • $name
      The name string.
      $value
      The value string.
      $filter
      Bool passed on to definition list.
    • Return
    • An HTMLHyperText Markup Language - the coding standard for a web page. string containing the formatted pair.

    themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._none_option($string = NULL)

    Returns a themed "none" string, for usage in a select form. This is in case you wish a general or consistent way of building the <none> strings.

    • Calling parameters
    • $string
      optionally provide a string that goes in the place of the word "none". If you provide this, it will not be translated.
    • Return
    • Themed "none" string ready to be inserted within a select list.

    themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look._shorten_string($short_string, $full_string, $count_addition = 3)

    Function to themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look. the a shortened string (see "shorten_string" above).

    • Calling parameters
    • $short_string
      The shortened string
      $full_string
      The unshortened string, for display in the tooltip
      $count_addition
      Optional. The number of fill characters that the calling function wants to be added. Defaults to three (3).
    • Return
    • HTMLHyperText Markup Language - the coding standard for a web page. string containing the themed string.