Extending BB core modules

About this forum
These forums have not been active for several years. They're available for search and reference, but a lot of this information is likely out of date.

For current information, try visiting our Knowledge Base.

Home / Support / Custom Module Development / Extending BB core modules

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #115350

    Elemento IP
    Participant

    Hey,

    I am adding a custom photo module, now instead of developing it from scratch, I want to inherit from FLPhotoModule.

    All my module does it loads an image on realtime, (modifies the settings or sets defaults), doesn’t matter.

    class MyPhotoModule extends FLPhotoModule {

    Now, this is impossible because FLPhotoModule’s constructor doesn’t accept arguments, although it could have been a very power features if you just make it accept $params, so I can pass my custom $params and enjoy the power of the current module without having to copy paste the core code or modify core code.

    This is the current code

    
    public function __construct()
    {
    	parent::__construct(array(
    		'name'          	=> __('Photo', 'fl-builder'),
    		'description'   	=> __('Upload a photo or display one from the media library.', 'fl-builder'),
    		'category'      	=> __('Basic Modules', 'fl-builder'),
    		'partial_refresh'	=> true
    	));
    }
    

    And it would be great if you make a default param this way

     public function __construct($params = null)
    {
    	$params = empty($params) ? $params : array(
    		'name'          	=> __('Photo', 'fl-builder'),
    		'description'   	=> __('Upload a photo or display one from the media library.', 'fl-builder'),
    		'category'      	=> __('Basic Modules', 'fl-builder'),
    		'partial_refresh'	=> true
    	));
    
    	parent::__construct($params);
    }
    

    This change may take you a few minutes to do but this could be very powerful for my project in particular but the BB community in general.

    I am creating custom modules and I realized that it lacks scalability in some areas.

    PLEASE DO THIS, IT WOULD BE GREAT IF YOU DO FOR OTHER MODULES (GALLERY, ETC…)! YOU WILL SAVE ME HOURS, AND THIS WILL ONLY BOOST UP THE COMMUNITY SO WE CAN KEEP EXTENDING 🙂

    Thanks,
    Elemento Team!

    #115359

    Elemento IP
    Participant

    Fix: !empty($params)

    But surely oyu got the idea

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Custom Module Development’ is closed to new topics and replies.