Skip to content

Commit

Permalink
WPCIVIUX-148 Settings page inputs for civicrm_plugin_activation_block…
Browse files Browse the repository at this point in the history
…s settings
  • Loading branch information
agileware-iris committed Aug 7, 2024
1 parent ea2926f commit b116b5a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions admin/partials/civicrm-ux-admin-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ function civicrm_ux_settings_page() {
$opt_contribution_ux = Civicrm_Ux::getInstance()
->get_store()
->get_option('civicrm_contribution_ux');

$plugin_activation_blocks = Civicrm_Ux::getInstance()
->get_store()
->get_option('civicrm_plugin_activation_blocks');

?>
<div class="wrap">
<h1>CiviCRM UX</h1>
Expand Down Expand Up @@ -106,6 +111,19 @@ function civicrm_ux_settings_page() {
</td>
</tr>
</table>
<h2>Plugin Activation Blocks</h2>
<p>Prevent the following plugins from being activated.</p>
<table>
<?php
// Add extra plugin options here.
// Defaults set in /includes/class-civicrm-ux-option-store.php
?>
<tr style="vertical-align: text-top;">
<td colspan="2"><input type="checkbox" id="event_tickets" name="civicrm_plugin_activation_blocks[event_tickets]"
<?php echo isset($plugin_activation_blocks['event_tickets']) && $plugin_activation_blocks['event_tickets'] ? ' checked="checked">' : '>'; ?>
<label for="event_tickets">Event Tickets</label></td>
</tr>
</table>
</div>
<?php submit_button(); ?>
</form>
Expand Down
5 changes: 5 additions & 0 deletions includes/class-civicrm-ux-option-store.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public function __construct() {
'is_recur_default' => FALSE,
'is_autorenew_default' => FALSE,
] );

// For Plugins we wish to block
$this->register_option( 'civicrm_plugin_activation_blocks', NULL, [
'event_tickets' => TRUE,
] );
}

public function register_option( $name, $instance, $default = '' ) {
Expand Down

0 comments on commit b116b5a

Please sign in to comment.