无法创建drupal 7模块

时间:2015-09-25 13:23:56

标签: drupal drupal-7

其实我正在尝试创建drupal模块。但我是Faild

这是我的代码。我只是想通过使用模块来显示Iframe。

CODE(MY_info.info):

name = MY_info
description = embedded widget
core = 7.x

CODE(My_info.module)

/**
 * @file
 * MY_info.module
 */

/**
 * Implements hook_menu().
 */
function MY_info_menu() {
  $items = array();
  return $items;
}

/**
 * Implements hook_form_alter().
 */
function MY_info_form_alter() {

}

任何人都可以帮助我如何创建它。 ?

1 个答案:

答案 0 :(得分:3)

您需要创建块模块才能显示iframe 使用hook_block_info(); hook_block_view();

试用这个代码(My_info.module)

<?php

function MY_info_block_info() {

  $blocks['MY_info_block'] = array(
    'info' => t('Your Content For Block Menu'),
    // DRUPAL_CACHE_PER_ROLE will be assumed.
  );

  return $blocks;
}


function MY_info_block_view($delta = '') {
  // This example is adapted from node.module.
  $block = array();

  switch ($delta) {

    case 'MY_info_block':

        $block['subject'] = t('Your Block Title');

          $block['content'] = "Your Html Content";

      break;
  }
  return $block;
}