2017 © Pedro Peláez
 

drupal-module contextual_views

Provides contextual views blocks.

image

drunomics/contextual_views

Provides contextual views blocks.

  • Wednesday, January 17, 2018
  • by fago
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2,144 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 9 % Grown

The README.md

Contextual Views

Drupal module that provides contextual views blocks., (*1)

  • Project homepage: https://www.drupal.org/project/contextual_views

Composer

  • It's suggested to install the module via composer:, (*2)

    composer require drunomics/contextual_views, (*3)

    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., (*4)

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., (*5)

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, (*6)

Todos

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

Contributing

Always use the Module issue queue., (*7)

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., (*8)

There are a few conventions that should be followed when contributing:, (*9)

  • 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)

The Versions

17/01 2018

dev-8.x-1.x

dev-8.x-1.x

Provides contextual views blocks.

  Sources   Download

31/05 2017

1.0.4

1.0.4.0

  Sources   Download

23/03 2017

1.0.3

1.0.3.0

  Sources   Download

22/03 2017

1.0.2

1.0.2.0

  Sources   Download

10/03 2017

1.0.1

1.0.1.0

  Sources   Download

10/03 2017

1.0.0

1.0.0.0

  Sources   Download