Account Area Pages/Sets are Response Builders (link) which means that they can be extended using a pipeline. You can use all of the usual Response Builder stuff and also for pages you can add/remove/update sections using addSection, addSectionAfter, addSectionBefore, and removeSection.
addSection Method
This method accepts a key string and a view string. A section added with this method will be added as the first section.
addSectionBefore Method
This method accepts the same parameters as the addSection method but additionally accepts a third parameter, the key of the section this new section should be added before.
addSectionAfter Method
This method accepts the same parameters as the addSection method but additionally accepts a third parameter, the key of the section this new section should be added after.
removeSection Method
This method accepts one parameter, the key of the section to remove.
Finding the Current Section Keys
If you do not know the keys of the current sections you can use this code snippet to dump the current keys out when visiting the page.
<?php
namespace Acme\MyModule;
use Aero\AccountArea\Http\Responses\AccountOrdersPage;
use Aero\Common\Providers\ModuleServiceProvider;
class ServiceProvider extends ModuleServiceProvider
{
public function setup()
{
AccountOrdersPage::extend(function (AccountOrdersPage $page) {
dd($page->getSections()->keys());
});
}
}
<?php
namespace Acme\MyModule;
use Aero\AccountArea\Http\Responses\AccountOrdersPage;
use Aero\Common\Providers\ModuleServiceProvider;
class ServiceProvider extends ModuleServiceProvider
{
public function setup()
{
$this->loadViewsFrom(__DIR__.'/../resources/views', 'my-module');
AccountOrdersPage::extend(function (AccountOrdersPage $page) {
$page->addSection('my-section', 'my-module::view');
$page->addSectionAfter('my-other-section', 'my-module::view', 'navbar');
});
}
}