1 block_example.module block_example_contents($settings)

A module-defined block content function.

Related topics


modules/examples/block_example/block_example.module, line 183
Hook implementations for the Block Example module.


function block_example_contents($settings) {
  // Modules would typically perform some database queries to fetch the
  // content for their blocks. Here, we'll just use the config set in the
  // block configuration or, if none has set, a default value.
  // Block content can be returned in two formats: renderable arrays
  // (as here) are preferred though a simple string will work as well.
  // Block content created through the UI defaults to a string.
  $string = $settings['example_string'];
  if ($settings['uppercase']) {
    $string = backdrop_strtoupper($string);
  $result = array(
    '#markup' => check_plain($string),
  return $result;