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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Drupal自定义块在列表中不可见相关的知识,希望对你有一定的参考价值。

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

信息:

   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;
}

我也按照禁用模块>>卸载>>清除缓存>>激活。

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

答案

你的HOOK_block_info不会返回blocks变量。 将其更改为:

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;
}

以上是关于Drupal自定义块在列表中不可见的主要内容,如果未能解决你的问题,请参考以下文章

Visual Studio 自定义代码片段在方法定义的参数列表中不起作用

Drupal 自定义表单记住文本字段数据

Javascript代码片段在drupal中不起作用

滑块在 PHP 中不可见,但在 HTML 中有效

ExtJS 滑块在视图中不可见

Onclicklistener 在片段列表视图中不起作用