Skip to main content

There are some steps to reference a view's block display from a field.They are

Step1: Create a region in your theme.

  1. Open your theme.info.yml.
  2. Find the section for "regions:"
  3. Add a new line: sample: 'Sample Region'
regions:
header: 'Header'
primary_menu: 'Primary Menu'
secondary_menu: 'Secondary Menu'
page_top: 'Page Top'
page_bottom: 'Page Bottom'
breadcrumb: 'Breadcrumb'
main_content: 'Main Content'
sidebar_first: 'Sidebar First'
sidebar_second: 'Sidebar Second'
footer_first: 'Footer First'
footer_second: 'Footer Second'
footer_third: 'Footer Third'
sample: 'Sample Region'

Step2: create a view with a block display.

  1. Go to admin/structure/views/add
  2. Create your view with a block display.

Step3: Place an instance of the block in the sample region.

  1. Go to admin/structure/block
  2. Find the sample region.
  3. Click “Place block”.
  4. Find the views block and assign that block in the sample region.

Step4: Create a reference field.

  1. Go to admin/structure/types/manage/type/fields.
  2. Click “Add field”.
  3. In that “Add a new field” dropdown, choose “other” under  “reference”.
  4. Label the field and save.
  5. Under "Type of item to reference" choose "Block" under "Configuration" and save.
  6. Configure as desired and then save.

Step5: Add the block to the content.

  1. Add a new item of the content type from step 4 at /node/add/TYPE.
  2. We can see our new field in the content.If you set the default in Step 4, the view will automatically be filled in.

It is used to display the views block content between the fields.

 

Contributor(s)