How to display custom data array via Twig I've created service which gets the raw data from custom content type. It looks like this :


  Array
(
    [front_page_slider] => Array
        (
            [1] => Array
                (
                    [title] => Lorem ipsum dolor sit amet
                    [body] =>Some example slider text up here
                    [field_image] => http://localhost/drupal8/sites/default/files/2016-05/slider1.png
                    [field_link_uri] => http://example.com
                    [field_link_title] => see more
                )

        )

)


After that i use array_push function to add this array $variables global variable. 

I've tried to display any of this fields like this:

{{ dump(front_page_slider[1].title) }}


or this:
  {{ dump(front_page_slider) }}

But both return NULL. What I do wrong ?
Have you added 'front_page_slider to the variables array in your twig template definition?

File...module_name.module

function hook_theme(array $existing, $type, $theme, $path) {
  return [
    'template_name' =&gt; [
          'variables' =&gt; [
           'front_page_slider' =&gt; [],
      ],
    ],
  ];
}