Roots Discourse

How implement hero section, correct way

I want to implement Hero section inside header template
I use Sage 10, I’ve never worked with Laravel and that’s why I don’t quite understand how to work with View Composers

How it’s implemented now:

  1. I created a file Fields/Hero.php
    This displays ACF on the desired page

  2. I created file Composers/Hero.php
    This is where I get fields from ACF and pass them to the with() function.
    Also in the array $views I list the blade templates

  3. In the header.blade.php I check if Hero is on and connect the template

  4. In the file hero.blade.php I already get data from Composers/Hero.php and output the layout

Interested in 2 and 3 point, everything is correct here? And how could it be done differently?


Any ideas or recommendation?)

Need help:)
Any ideas or recommendation or examples?

Why dont you use ACF flexible Content?

It looks fine, if you ask me.

What specifically are you look for help with?

This topic was automatically closed after 42 days. New replies are no longer allowed.