WIACPSite theme 0.2.0-alpha.92
Türkçe

§6

Home page sections

The theme defines the sections it offers in the manifest; the administrator switches them on / off, orders them, chooses desktop / mobile visibility and enters per-language title, subtitle, text, button and short items (icon, title, text) in Themes › Site › Home page sections.

php
'sections' => [
    ['key' => 'hero', 'label' => ['en' => 'Hero'], 'fields' => ['title', 'subtitle', 'text', 'button', 'items'],
        'defaults' => ['title' => 'home.hero.title', 'button' => ['label' => 'home.hero.button', 'url' => '#products'],
            'items' => [['icon' => 'bolt', 'title' => 'home.hero.i1', 'text' => 'home.hero.i1_text']]]],
    ['key' => 'products', 'label' => ['en' => 'Products'], 'fields' => ['title'], 'source' => 'product_groups'],
    ['key' => 'reviews', 'label' => ['en' => 'Reviews'], 'fields' => ['title'], 'source' => 'testimonials', 'enabled' => false],
],
  • fields: title, subtitle, text, button, items, faq.
  • source (optional): product_groups, references, testimonials, slides, posts, domain_search, newsletter. With the product groups source the administrator can choose groups and the maximum number of records shown.
  • defaults: values are language.php keys. A section that has never been saved shows these texts; the admin screen opens them filled in. Once the administrator saves, their text is used.
  • enabled: false makes the section start switched off.

homepage.wcp:

blade
@foreach ($sections as $section)
    @includeIf('includes.sections.' . $section['key'], ['section' => $section])
@endforeach

$section: key, title, subtitle, text, button (label, url or null), items (icon, title, text), options, source, class (wi-hide-desktop / wi-hide-mobile for device visibility; define them in your theme's CSS), docked (domain search docked onto the slider, §5.9).