Hello everybody
i’m having some issue while trying to use Sage 9 for the first time.
Specifically, it seems that no matter what I try there’s no way to get any values from the $data array inside the template.
I’ve stepped trough the code with xdebug, and I can confirm the filter gets properly registered with the right template, but once the debugging process reaches the template there’s no trace of $data in the stack. Both $data and the contents of the array are undefined.
here’s the call:
<?php
namespace App;
add_filter('sage/template/template-bottega/data', function () {
$data = [
'people' => [
'nome' => 'Nome 1',
'descrizione' => 'Descrizione 1',
'foto' => 'https://www.bottega.local/wp-content/example.png',
'ruolo' => 'Cuoco'
]
];
return $data;
});
in views/template-bottega.blade.php
{{--
Template Name: Bottega
--}}
@extends('layouts.app')
@section('header')
@component('partials.headers.header-page')
@endcomponent
@endsection
<h1>{{ $people }}</h1>
@section('content')
@while(have_posts()) @php the_post() @endphp
@include('partials.content-page')
@endwhile
@endsection
Other than a “Undefined Variable Error” All I get is the following exception:
Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Container\Container] is not instantiable while building [Illuminate\Events\Dispatcher].
Any help would be appreciated.
Cheers,
Salvo