Drupal自定义块在列表中不可见

时间:2017-12-30 05:59:34

标签: drupal drupal-7 drupal-modules

我从头开始创建了四个模块。在那两个模块显示和两个模块不显示。现在我已经创建了另一个新模块,但仍然没有显示。

信息:

   name = Issuu Home
   description = Issuu Home API
   core = 7.x
   configure = sites/all/modules/ac/Issuu Home
   package = AC

模块:

<?php
/**
* Purpose:
* Implements issuu_home_block_info.
*
*
* @return $blocks
*
* @since Feb 2017
*/
function issuu_home_block_info() {
  $blocks['issuu_home'] = array(
      'info' => t('Issuu Home block for issuu landing page'),
      'subject' => t('Issuu Home block for issuu landing page'),
      'cache' => DRUPAL_NO_CACHE,
      //'status' => 1,
      //'visibility' => 1,      
      //'weight' => 0,
      //'cache' => DRUPAL_CACHE_PER_ROLE,
      //'status' => 1,
      // For block to be listed as disabled on blocks page, set region to -1.
      'region' => -1,
      //'theme' => 'csny',
    );
}
function issuu_home_menu() {
  $items = array();
  $items['issuu_home'] = array( //this creates a URL that will call this form at "examples/form-example"
    'title' => 'Issuu Home List', //page title
    'description' => 'List of Issuu Home',
    'page callback' => 'issuu_home', //this is the function that will be called when the page is accessed.  for a form, use drupal_get_form
    'type' => MENU_CALLBACK,
    'access callback' => TRUE
  );

  return $items;
}
function issuu_home() {
    $output = "Issu Home"
    return $output;
}
/**
 * Implements hook_block_view
 *
 * Passes off the function call to _custom_module_view_DELTA
 */
function issuu_home_block_view($delta = '') {
    $blocks = array();
    $blocks['issuu_home_block'] = array(
        'info' => t('Issuu Home Block'),
        'subject' => t('Issuu Home Block'),
        'status' => 1,
    );
    $block = array(
        'content' => issuu_home(),
    );
    return $block;
}

我还关注了停用模块&gt;&gt;卸载&gt;&gt;清除缓存&gt;&gt;激活。

我尝试过状态,缓存但没有运气。

1 个答案:

答案 0 :(得分:1)

您的HOOK_block_info不会返回块变量 将其更改为:

function issuu_home_block_info() {
  $blocks['issuu_home'] = array(
      'info' => t('Issuu Home block for issuu landing page'),
      'subject' => t('Issuu Home block for issuu landing page'),
      'cache' => DRUPAL_NO_CACHE,
      //'status' => 1,
      //'visibility' => 1,      
      //'weight' => 0,
      //'cache' => DRUPAL_CACHE_PER_ROLE,
      //'status' => 1,
      // For block to be listed as disabled on blocks page, set region to -1.
      'region' => -1,
      //'theme' => 'csny',
  );

  // You must return the $blocks variable
  return $blocks;
}