- <?php
- * @file
- * Provide test blocks.
- */
-
- * Implements hook_block_info().
- */
- function block_test_block_info() {
- $blocks['test_cache'] = array(
- 'info' => t('Test block caching'),
- 'cache' => state_get('block_test_caching', BACKDROP_CACHE_PER_ROLE),
- );
-
- $blocks['test_underscore'] = array(
- 'info' => t('Test underscore'),
- );
-
- $blocks['test-hyphen'] = array(
- 'info' => t('Test hyphen'),
- );
-
- $blocks['test_html_id'] = array(
- 'info' => t('Test block html id'),
- 'description' => t('Original description.'),
- );
- return $blocks;
- }
-
- * Implements hook_block_view().
- */
- function block_test_block_view($delta = 0) {
- return array('content' => state_get('block_test_content', 'Original content.'));
- }
-
- * Implements hook_block_info_alter().
- */
- function block_test_block_info_alter(&$blocks) {
- if (state_get('block_test_info_alter') && isset($blocks['block_test'])) {
- $blocks['block_test']['test_html_id']['description'] = 'Altered description.';
- }
- }
-
- * Implements hook_block_view_MODULE_DELTA_alter().
- */
- function block_test_block_view_block_test_test_underscore_alter(&$data, $block) {
- $data['content'] = 'underscore: hook_block_view_MODULE_DELTA_alter';
- }
-
- * Implements hook_block_view_MODULE_DELTA_alter().
- */
- function block_test_block_view_block_test_test_hyphen_alter(&$data, $block) {
- $data['content'] = 'hyphen: hook_block_view_MODULE_DELTA_alter';
- }