0vote

What Does auto_use Load, and Where Does it Load It?

Most manifest.xml files have a configuration similar to the following

FCom_Frontend:
    auto_use: [ layout, views ]

It's not clear from context what auto_use does. I assume it's some sort of dependency injection, but it's not clear how we'd use this in our own modules, or what effect the [layout, views] values have on stock modules.

What Does auto_use Load, and Where Does it Load It?

1 Answer

3votes

Fulleron has progressed incrementally as a framework. Originally, for simplicity and minimalism, all of the module initialization logic was defined with pure PHP, in a module bootstrap method. In fact, everything in Fulleron has been in PHP, including manifest files, layouts, cache and templates.

<?php

class FCom_Module_Admin extends BClass
{
    static public function bootstrap()
    {
        BLayout::i()
            ->loadLayoutAfterTheme('FCom_Module_Admin.layout') // add module layout instructions
            ->addAllViews('views') // load global module views (emails)
            ->addAllViews('Admin/views') // load area specific module views
        ;
    }

    public function layout()
    {
        BLayout::i()->addLayout(array(
            // Module layout update as PHP array
        ));

    }
}

This was a clear and a simple solution, but started proving to be repetitive, as it was exactly the same code for every module. In addition, it required loading both manifest file and a class file for every module.

Since most of the modules required views or layouts, I’ve tried to implement automatic scanning for layout and view files on bootstrap, but that was wasteful for modules that didn’t have views or layouts available. So the decision was to add a shortcut in manifest file, that would register layout and views from default locations. For custom needs the PHP way is still available, but haven’t been really needing it.

As to where the processing happens, look in FCom/Core/buckyball/com/module.php, BModule::_processAutoUse(). The possible values are: auto_use: [ bootstrap, views, layout ]

...