elementor / elementor/activity-log

Feature request: allow to override instance implementations

Open
#100 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
188
Forks
55
Avg merge
1d 19h
Merged PRs (30d)
12

Description

Hi,

I use your plugin for a [framework I've built](https://getpop.org), however I needed a couple of minor changes to make it work. Please check if you agree with these changes, then I can do the pull request and implement them myself.

*1. I need to change some functionality in classes `AAL_API` and `AAL_Notifications`, for which I've inherited from these classes. So, I need to be able to set the my own instances of these classes instead of the default ones.

In function `AAL_Main::__construct()`, I'd like to change:

$this->ui = new AAL_Admin_Ui();
$this->hooks = new AAL_Hooks();
$this->settings = new AAL_Settings();
$this->api = new AAL_API();
$this->notifications = new AAL_Notifications();
$this->help = new AAL_Help();

With `add_action ('plugins_loaded', array($this, 'init_instances'), 1000);`, and then:

function init_instances() {

$ui_class = apply_filters('AAL_Main:ui:classname', 'AAL_Admin_Ui');
$hooks_class = apply_filters('AAL_Main:hooks:classname', 'AAL_Hooks');
$settings_class = apply_filters('AAL_Main:settings:classname', 'AAL_Settings');
$api_class = apply_filters('AAL_Main:api:classname', 'AAL_API');
$notifications_class = apply_filters('AAL_Main:notifications:classname', 'AAL_Notifications');
$help_class = apply_filters('AAL_Main:help:classname', 'AAL_Help');

$this->ui = new $ui_class();
$this->hooks = new $hooks_class();
$this->settings = new $settings_class();
$this->api = new $api_class();
$this->notifications = new $notifications_class();
$this->help = new $help_class();
}

*2. I'd like to keep the notifications table, even if uninstalling the plug-in. Could there be an option, or even a hook, for this? I refer to this line, on file classes/class-aal-maintenance.php:

`
register_uninstall_hook( ACTIVITY_LOG_BASE, array( 'AAL_Maintenance', 'uninstall' ) );
`

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.