定制 drunomics/contextual_views 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drunomics/contextual_views

Composer 安装命令:

composer require drunomics/contextual_views

包简介

Provides contextual views blocks.

README 文档

README

Drupal module that provides contextual views blocks.

Composer

  • It's suggested to install the module via composer:

    composer require drunomics/contextual_views

    The module is also available as drupal/contextual_views via the drupal.org release system, however only drunomics/contextual_views gets patch level releases. This is as drupal.org does not support semantic versioning for modules yet.

Installation

Install as usual, see https://www.drupal.org/docs/8/extending-drupal-8/installing-contributed-modules-find-import-enable-configure-drupal-8 for further information.

Usage instructions

  • Define a block plugin with the same plugin ID as used automatically. E.g. views_block:news-news_by_channel . The pattern is views_block:{{ view }}-{{ display }}. This way the defined class will be used automatically instead of the default one.
  • Extend the class Drupal\contextual_views\Plugin\Block\ContextualViewsBlock
  • Define the necessary context on the plugin using annotations, e.g. the node context.
  • Alter the block form to add additional config as needed, e.g. a textfield that contains the name of the field holding the term reference.
  • Override build(), get the context value (e.g. the node), derive the views argument (the taxonomy term) from the context and set it on the view as argument using $view->setArguments(). Then call the parent build.

A complete code example for the described block can be viewed here: https://gist.github.com/fago/f51fe8861919a40c753a03c79a134848

Todos

  • Write more documentation
  • Provide a configuration form for satisfying views context based upon available block context.

Contributing

Always use the Module issue queue.

Development happens on GitHub using the pull request model: in case you are not familiar with that, please take a few minutes to read the GitHub article on using pull requests.

There are a few conventions that should be followed when contributing:

  • Always create an issue in the drupal.org issue queue for every pull request you are working on.
  • Always cross-reference the Issue in the Pull Request and the Pull Request in the issue.
  • Always create a new branch for every pull request: its name should contain a brief summary of the ticket and its issue id, e.g readme-2276369.
  • Try to keep the history of your pull request as clean as possible by squashing your commits: you can look at the Symfony documentation or at the Git book for more information on how to do that.

For further information on how to contribute please refer to the documentation.

统计信息

  • 总下载量: 10.97k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-05-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固