Drupal8

Drupal Suggests Page template for Revisions nodes

leopathu on Wed, 01/27/2021 - 23:54

Drupal has a lot of amazing functionalities within it. Revisions are one among them, actually, it helps us to manage the different versions of the node. Whenever we can get back our old version of the node. One more interesting thing is this there is a module diff as contrib module which will help us to view the difference between each version. It shows the difference in fields level so we can see the difference of each field's data in side by side.

Drupal 8 Render views through Ajax

leopathu on Fri, 07/24/2020 - 14:58

Views is one the powerful functionality of the Drupal, Drupal 8 includes it in the core. We mostly used to export and present the data as a page, block and REST api, but there is one more way to render the views from jquery with the help of ajax. There is views/ajax api path to call the views with some arguments and views details(name, display id etc..).

The below code show you to render a views through ajax,

Tags

Drupal 8 Programmatically Add Youtube Video to Video Field

leopathu on Thu, 07/23/2020 - 23:10

Drupal 8 gives various type of fields includes the video field. In the video field there is an option to add different kind of videos like upload, youtube, vimeo, wistia videos to the drupal fields. When you create a node programmatically we have to set values to the custom fields. Normally we set the values to the fields in the following way,

$node->set('video_field','url-of-video');

Unfortunately it wont work for the video field, we have to do it in a different way like the following code,

Tags