Extending a core module file
Created 7 years ago by failcookie

I would like to extend the PostsModule.php file to alter the sections to add a couple of new streams and to change the icon (client request). I have created an extension that handles all of my core module overwrites for Posts and have mimicked the PostsModule.php and extended to a custom ExtPostsModule.php, but how do I make sure the extension calls this extended file and overwrites the Posts module?

failcookie  —  7 years ago

Turns out it is really easy. For my case, I wanted to add a new section to house the stream I created for company_category. In your ExtensionServiceProvider.php add in the following in the map() function:

public function map(AddonCollection $addonCollection)
    {
        $sections = [
            'company_category' => [
                'buttons' => [
                                    'new_company_category',
                ],
            ],
        ];
        $addonCollection->get('anomaly.module.posts')->addSection('company_category', $sections);
    }