ACF installation on sage

Good afternoon, how are you?

I’m currently studying the development of a project in Sage 10. I am currently delving into the configuration of ACF for creating page options and page templates.

I’m not entirely sure how the logic used in the following link works: GitHub - Log1x/acf-composer: Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10. for configuration. I say this because I haven’t been able to create page options or any other features using controllers.

Since I’m in a simpler development environment, I can’t execute the “wp acorn” functions, and I would like to understand the logic behind this structure more thoroughly. This will help me to truly understand what is happening.

I apologize in advance for any basic or intrusive questions. I am new to Sage, and I am really enjoying working with the tool. In fact, that’s the reason I want to delve deeper into it.


Additional Information:

I have a recently installed Sage 10 theme following the standard instructions. All directories are in their default installation state.

What I did was:

  • Create “config/acf.php”
  • Create the “Options” folder in “app” with the following content:

OptionPage.php

<?php

namespace OptionPage;

use Log1x\AcfComposer\Options as Field;
use StoutLogic\AcfBuilder\FieldsBuilder;

class OptionPage extends Field
{
    /**
     * The option page menu name.
     *
     * @var string
     */
    public $name = 'Option Page';

    /**
     * The option page document title.
     *
     * @var string
     */
    public $title = 'Page | Options';

    /**
     * The option page field group.
     *
     * @return array
     */
    public function fields()
    {
        $DummyCamel = new FieldsBuilder('OptionPage');

        $DummyCamel
            ->addRepeater('items')
                ->addText('item')
            ->endRepeater();

        return $DummyCamel->build();
    }
}

Your namespace doesn’t match the directory path you described, so this file won’t be autoloaded.

See:

1 Like

Good morning!
I apologize for the delay in getting back to you.

I studied the articles you sent and reworked the logic of the controller usage. Initially, it still wasn’t working, which prompted me to research more information and understand why, even with the controller configured correctly, nothing was happening.

That’s when I found this post: Installing produces PHP Fatal Error · Issue #102 · Log1x/acf-composer · GitHub

Within it, I found the need to run the command: wp acorn optimize:clear. This allowed me to create the file, and everything is working perfectly now!

Thank you for the support and assistance; I was really confused about the PSR-4 generation logic (which I also noticed is referenced as an auto-loader in composer.json).

1 Like