简体   繁体   English

Drupal 7以编程方式替换视图中的字段

[英]Drupal 7 Programmatically Replace Field in Views

I have a question regarding Drupal 7 and the Views API. 我对Drupal 7和Views API有疑问。

I'm writing a module that replaces specific text in views. 我正在写一个替换视图中特定文本的模块。 Essentially what I'm trying to do is scan text in a view (or page for that matter). 本质上,我想做的是在视图(或相应页面)中扫描文本。 Let's say the view has [special button] will be replaced with 假设视图中的[特殊按钮]将替换为

l(t('button'),'mypage',array('query',array('page'=>$node->nid))); 

Or whatever. 管他呢。 Please understand this is pseudo code. 请理解这是伪代码。

I've took a look at hook_view() , hook_node_view() ( http://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_view/7 ) and neither of them seem to work for me. 我看过hook_view()hook_node_view()http://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_view/7 ),但它们似乎都没有为我工作。

I've also looked at http://drupal.org/node/1510828 but that didn't seem to help me out. 我也看过http://drupal.org/node/1510828,但这似乎对我没有帮助。

Have you tried selecting 'rewrite the output of this field' on the field/s ? 您是否尝试过在字段上选择“重写此字段的输出”? Or alternatively Views PHP should be able to do what you want. 或者, Views PHP应该能够执行您想要的操作。

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

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