Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add updates to options page functionality from #114 #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 30 additions & 22 deletions src/ActionMonitor/Monitors/AcfMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,42 @@

namespace WPGatsby\ActionMonitor\Monitors;

class AcfMonitor extends Monitor {
class AcfMonitor extends Monitor
{
public function init()
{
// ACF Actions
add_action(
'acf/update_field_group',
function () {
$this->trigger_schema_diff(
[
'title' => __('Update ACF Field Group', 'WPGatsby'),
]
);
}
);

public function init() {
// ACF Actions
add_action(
'acf/update_field_group',
function() {
$this->trigger_schema_diff(
[
'title' => __( 'Update ACF Field Group', 'WPGatsby' ),
]
);
}
);
add_action(
'acf/delete_field_group',
function () {
$this->trigger_schema_diff(
[
'title' => __('Delete ACF Field Group', 'WPGatsby'),
]
);
}
);

add_action(
'acf/delete_field_group',
function() {
add_action(
'acf/save_post',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will trigger on every save_post. This means on every type of post update this will be triggered in addition to ActionMonitors already in place.

function () {
$this->trigger_schema_diff(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding trigger_schema_diff is for the case of a schema change. For example changing Advanced Custom Fields field groups. In the case of an Option Page update we are looking for a content change though, content that is written in the wp_options table specifically.

[
'title' => __( 'Delete ACF Field Group', 'WPGatsby' ),
'title' => __('Update option page', 'WPGatsby'),
]
);
}
);

// @todo: Add support for tracking ACF Options Fields.

}

}
}