This project is not covered by Drupal’s security advisory policy.

INTRODUCTION

A way to add relevant articles in the middle of content.

INSTALLATION

Install as you would normally install a contributed Drupal module. See: https://www.drupal.org/node/895232 for further information.

CONFIGURATION

A way to add relevant articles defined in link type field or entity reference using ief in the middle of content.

Check readme.md to see documentation

It needs to define the configuration in template_preprocess_node, as this:

use Drupal\inline_related_posts\Hook\InlineRelatedPostsThemeHooks;

your_theme_preprocess_node(&$variables) {

  // Both automatic and manual mode
  // bundle_host: The content bundle that allow inline related in its body.
  $variables['related_posts_bundle_host'] = 'article';
  // host_view_mode: The host view mode where to add inline related content.
  $variables['related_posts_bundle_host_view_mode'] = 'full';
  // host_related_links_field: The field that holds the related links in host entity.
  $variables['related_posts_host_related_links_field'] = 'field_related_links';
  // inline_view_mode: The view-mode used to render the related content.
  $variables['related_posts_inline_view_mode'] = 'inline_related';

  // Automatic mode only:
  // paragraph_length: The length of paragraph to be surpassed to append inline related post.
  $variables['related_posts_paragraph_length'] = 1000;

  //It's mandatory to call the InlineRelatedPostsThemeHooks->preprocessNode after.
  \Drupal::service(InlineRelatedPostsThemeHooks::class)->preprocessNode($variables);

}

It may be used as manual or automatic mode:

  • Manual: It must be used together with the ckeditor5 plugin, so you'll need to configure in text formats, to tell which field will be used as related links origin. Then when editing text you could place the slots that will be filled later.

  • Automatic: By now it doesn't have a configuration ui to define the paragraph length to be surpassed to append inline related post after, it should be done in $variables['related_posts_paragraph_length'] (see previous code example)

MAINTAINERS

Current maintainers for Drupal 10:

Supporting organizations: 

Project information

Releases