创建一个节点内容类型视图菜单标签

论坛: 

图像
创建一个如上图所示的TAB卡片式显示内容菜单模板方法:
1、新建一个views
图像
2、为views显示设置建立页面路径
图像
3、
接下来我们将设置为views显示页面设置菜单标签
图像
4、Setup the View Fields, Sort Criteria and Filter Criteria

Feel free to add any fields, sorting and filters you'd like to get the data you'd like. In my case, I was only interested in sorting by the nodes last updated date and seeing these fields:

5、ON划词翻译ON实时翻译

4. Setup the View Contextual Filter

4。设置视图上下文过滤器

In my particular example, I did not need any filters because I wanted results across all content types and didn't care if they were published or not. What I did want however, was a contextual filter so the results could be limited to the current node.

在我的例子中,我不需要任何过滤器,因为我想要的结果在所有类型的内容,不在乎他们发表或不。我想然而,是一个上下文过滤器,结果可能是有限的到当前节点。

Under the 'Contextual Filters' settings on your View Display, click the 'Add' button to create a contextual filter for your Node ID. Typically you could use one of your node reference fields here as your contextual filter. You may have to tinker with your Contextual Filter settings for a while to get the results you want, be sure to use the 'Preview' mode in views and send along a Node ID to the preview.

在你的视图中显示的上下文过滤器的设置,请单击“添加”按钮来创建您的节点ID。一个上下文过滤器通常你可以用你的一个节点的参考域这里作为您的上下文过滤器。你会修理你的上下文过滤器设置一会儿来得到你想要的结果,一定要使用“预览”模式的观点和发送节点ID的预览。

5. Save the View

5。保存视图

Once you have the results you want filtering on your node id, just save your view and you will now have a custom local task menu tab show up on all of your nodes!

一旦你有你想要的过滤你的节点ID的结果,仅保存你的观点,现在你将有一个自定义的本地任务菜单标签对你所有的节点显示!

Pretty cool huh? Yes indeed. But what if you want this tab to only show up on a particular content type? Because right now, it will show up on all content types.

很酷吧?的确是的。但是如果你想要这个标签只在一个特定的内容类型的节目了吗?因为现在,它将对所有类型的内容显示出来。

How to get the tab to show up on a specific content type...

如何获得标签在一个特定的内容类型的显示…

UPDATE: See this comment for a much easier approach to controlling access to this tab. Otherwise you may try the alternative code-based approach listed below. However, I don't think this approach works anymore with later versions of Views because I can't seem to get my Views path to show up in the $items array. So your best bet would be to use Joachim's comment linked above.

更新:看到这个评论的一个更简单的方法来控制这个选项卡访问。否则,你可能会为基础的方法,下面列出的其他代码。然而,我不认为这种方式了意见以后的版本因为我似乎无法显示在美元的项目,我的看法路径阵列。所以你最好是用约阿希姆的评论链接。