1 layout_test.module layout_test_block_view($delta = '', $settings = array(), $contexts = array())

Implements hook_block_view().

File

core/modules/layout/tests/layout_test/layout_test.module, line 76
Layout test module.

Code

function layout_test_block_view($delta = '', $settings = array(), $contexts = array()) {
  $block = array();

  switch ($delta) {
    case 'foo':
      $settings += array(
        'count' => 0,
      );
      $block['subject'] = 'Foo subject';
      $block['content'] = format_string('The setting of count is @setting.', array('@setting' => $settings['count']));
      break;

    case 'bar':
      $block['subject'] = 'Bar subject';
      $mail = !empty($contexts['my_user']->mail) ? $contexts['my_user']->mail : 'unavailable';
      $block['content'] = format_string('The user email is @mail and the node title is @title', array('@mail' => $mail, '@title' => $contexts['my_node']->title));
      break;

    case 'test_node_title':
      $block['subject'] = 'Node title';
      $block['content'] = format_string('The node title is @title', array('@title' => $contexts['node']->title));
      break;

    case 'test_passthrough':
      $block['subject'] = 'Passthrough title';
      $block['content'] = format_string('The page argument is @string', array('@string' => $contexts['string_value']));
      break;
  }
  return $block;
}