Extending BB core modules

#1

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 :slight_smile:

Thanks,
Elemento Team!

#2

Fix: !empty($params)

But surely oyu got the idea

closed #3