Home Forums RedExp Themes Slider Revolution Render RevSlider Block In TWIG Template

This topic contains 4 replies, has 2 voices, and was last updated by  Harry 1 year, 8 months ago.

How would you rate the support you received?
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

  • Author
    Posts
  • #7527

    Prashant Dandekar
    Participant

    I want to render revslider block in my node TWIG template
    i have tried using following method but no luck

    function smashtheme_preprocess_node(&$variables) {
    $block = \Drupal\block\Entity\Block::load(‘slider’);
    $block_content = \Drupal::entityTypeManager()
    ->getViewBuilder(‘block’)
    ->view($block);
    $variables[‘slider_block’] = $block_content;
    }

    even tried with
    $block = \Drupal\block\Entity\Block::load(‘revslider_block_slider’); its giving error

    please help me to render/print the block in twig template
    I am able to render webform block by using above method.

    I want slider between the page content

  • #7574

    Harry
    Keymaster

    Hi

    Our bock slider ready on your admin ( no need access code ) in structure > block

    YOu can assisgn any where of your theme’s position

    best regards

  • #7591

    Prashant Dandekar
    Participant

    As I already told… I want sliders between content (not between blocks)
    I want slider block between paragraphs which is only possible via twig template or custom module.

  • #7690

    Harry
    Keymaster

    Hi
    You need get “Machine name” of block by place block in some where and it will show near title of block.
    code :
    $block = \Drupal\block\Entity\Block::load([Machine name]);
    $block_content = \Drupal::entityTypeManager()
    ->getViewBuilder(‘block’)
    ->view($block);
    or
    $con = \Drupal\block\BlockViewBuilder::lazyBuilder([Machine name], ‘full’);
    $html = \Drupal::service(‘renderer’)->renderPlain($con);
    and attach liblary:
    ‘#attached’ => array(
    ‘library’ => array(‘revslider/front-view’),
    ),

  • #7691

    Harry
    Keymaster

You must be logged in to reply to this topic.