简体   繁体   English

如何在Drupal 7中将数据打印到面板窗格?

[英]How to print data to Panel Pane in Drupal 7?

I am trying to send data to a Panel Pane. 我正在尝试将数据发送到面板窗格。

I have a simple .tpl file that for now just prints a message: 我有一个简单的.tpl文件,目前仅显示一条消息:

<?php print $message; ?>

However, I am having trouble sending the message data to this .tpl. 但是,我无法将消息数据发送到此.tpl。 The above print returns nothing. 上面的打印不返回任何内容。

On my .module file I have: 在我的.module文件中,我有:

/**
 * Implements hook_ctools_plugin_directory().
 */
function message_ctools_plugin_directory($owner, $plugin_type) {
  if (($owner === 'ctools' && !empty($plugin_type)) || ($owner === 'panels' && $plugin_type === 'styles')) {
    return "plugins/$plugin_type";
  }
}

/**
 * Implements hook_theme().
 */
function message_theme() {
  return [
    'message_base' => [
      'template' => 'theme/message',
      'variables' => [
        'message' => '',
      ],
    ],
  ];
}

And on the panel .inc file I have: 在面板.inc文件上,我有:

function message_panel_render($subtype, $conf, $args, $contexts) {
  $block = new stdClass();

  $config = default_settings();

  $block->content = [
    '#theme' => 'message_base',
    'message' => filter_xss($config['message']),
  ];

  return $block;
}

When I dpm($block); 当我dpm($block); within the above function I see all is correct. 在以上功能中,我看到的一切都是正确的。 It's just nothing seems to reach the .tpl file. .tpl文件似乎什么也没有。

Would anyone know what I've done wrong here? 有人知道我在这里做错了什么吗?

发现它在# '#message' => filter_xss($config['message']),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM