I want to put acf blocks in deeper folder but then for some reason, fields does not get assigned.
so for example i have a block class that looks like this:
<?php
namespace App\Blocks\about;
use Log1x\AcfComposer\Block;
use Roots\Acorn\Application;
use StoutLogic\AcfBuilder\FieldsBuilder;
class Herox extends Block
{
public function __construct(Application $app)
{
$this->name = __('Herox', 'sage');
$this->slug = 'about-herox';
$this->category = 'blocks';
$this->icon = 'editor-ul';
$this->keywords = [
'hero',
];
parent::__construct($app);
}
public function fields(): FieldsBuilder|array
{
$builder = new FieldsBuilder('about-herox');
$builder
->addText('titlex');
return $builder->build();
}
public function with(): array
{
return [
'title' => get_field('title'),
];
}
}
and in this case it works fine, it takes the blade file from
:web/app/themes/my-theme/resources/views/blocks/about-herox.blade.php
but i wanted to move the blade block to its own folder like this:
:web/app/themes/my-theme/resources/views/blocks/about/herox.blade.php
in this case, i changed the slug to: $this->slug = ‘about.herox’; and the template worked, but when i try to edit fields in it, it says that the fields are not defined. What could be the problem, sorry if it’s a rookie mistake im making, but i want to find the solution. (tried the gpt but it didn’t helped)
thanks!