vishalp's blog

Creating Next/Previous node pager using Views in Drupal 8

Looking for a way to implement next/previous node pager in Drupal 8? There are some modules available like Pager for Content type which allows you to create next previous pager for nodes with some configurations. But what if you want to create a pager which lets you manage conditions for next or previous node to be displayed e.g. display by author or category? Here I am going to show you, how to create a pager which lets you manage conditions and display of the next and previous node.

[D8]: Adding a class to more link of a view

In case you are looking for adding a css class to more link(displayed in footer) of a view in drupal 8, you can do it by implementing template_preprocess_views_view() in your theme under THEMENAME.theme file as shown below:

/**
 * Implements template_preprocess_views_view()
 * @param array $vars
 */
function THEMENAME_preprocess_views_view(&$vars){
  if(YOUR CONDITION FOR ADDING A CLASS){
    $vars['more']['#options']['attributes']['class'] = array(
      ENTER YOUR CLASSES AS ARRAY ELEMENTS
    );
  }
}

 

[D8]: Setting default logo path in a theme

If a custom logo is not specified, Drupal will search in the active theme for a default logo image file. This has been changed from a PNG file to a SVG file.

Themes that were providing a default logo.png will need to provide a logo.svg. PNG logos, or other image formats, can always be used by uploading the logo as a custom logo.

Themers can create extra custom settings in their themes to give support to non-SVG default logos.