Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Data Fields Don't Inherit From Hierarchy? #83

@natefoundry

Description

@natefoundry

I created a new page called Home (page-home.php) and set it as my Front Page. I'm attempting to use the ACF plugin to add fields to the home page and created a controller for it:

namespace App;

use Sober\Controller\Controller;

class PageHome extends Controller
{
    public function hero_video()
    {
        return get_field('hero_video');
    }
}

In my page-home.blade.php view:

  <div class="hero-background">
    <video autoplay muted loop playsinline>
      <source src="{{$hero_video}}" type="video/webm"/>
    </video>
  </div>

However, it doesn't seem to exist when I debug it:

Controller Debugger:
$site_name » string
$post » object
Hierarchy Debugger:
controllers/app.php
controllers/index.php
controllers/singular.php
controllers/page.php
controllers/page-14.php
controllers/page-home.php
controllers/front-page.php

If I move the hero_video() method to the controller for front-page.php it works:

<?php
namespace App;

use Sober\Controller\Controller;

class FrontPage extends Controller
{
  public function hero_video()
  {
      return get_field('hero_video');
  }
}

Debug output after change:

Controller Debugger:
$site_name » string
$post » object
$hero_video » string
Hierarchy Debugger:
controllers/app.php
controllers/index.php
controllers/singular.php
controllers/page.php
controllers/page-14.php
controllers/page-home.php
controllers/front-page.php

Is this the way inheritance for data fields is supposed to work? If not, what am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions