fix custom summary admin UI, faulty merge with main
All checks were successful
PHP Code Checker / PHP Code Checker (pull_request) Successful in 47s
PHPUnit / PHPUnit – PHP 7.4 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.0 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.4 (pull_request) Successful in 1m4s

This commit is contained in:
André Menrath 2024-12-15 17:01:15 +01:00
parent 23f415b401
commit 0c0bba5d15
3 changed files with 46 additions and 7 deletions

View file

@ -11,4 +11,24 @@ jQuery( function( $ ) {
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false ); $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
} }
} ); } );
// Function to toggle visibility of custom details based on selected radio button.
function toggleCustomDetailsForSummary() {
if ($("#event_bridge_for_activitypub_summary_type_custom").is(':checked')) {
$("#event_bridge_for_activitypub_summary_type_custom-details").show();
} else {
$("#event_bridge_for_activitypub_summary_type_custom-details").hide();
}
}
// Run the toggle function on page load.
$(document).ready(function() {
toggleCustomDetailsForSummary(); // Set the correct state on load.
// Listen for changes on the radio buttons
$("input[name=event_bridge_for_activitypub_summary_type]").change(function() {
toggleCustomDetailsForSummary(); // Update visibility on change.
});
});
} ); } );

View file

@ -3,7 +3,7 @@
* Plugin Name: Event Bridge for ActivityPub * Plugin Name: Event Bridge for ActivityPub
* Description: Integrating popular event plugins with the ActivityPub plugin. * Description: Integrating popular event plugins with the ActivityPub plugin.
* Plugin URI: https://event-federation.eu/ * Plugin URI: https://event-federation.eu/
* Version: 0.3.2.6 * Version: 0.3.2.7
* Author: André Menrath * Author: André Menrath
* Author URI: https://graz.social/@linos * Author URI: https://graz.social/@linos
* Text Domain: event-bridge-for-activitypub * Text Domain: event-bridge-for-activitypub

View file

@ -414,22 +414,41 @@ class Setup {
} }
/** /**
* Get the transmogrifier. * Get the transmogrifier class.
*
* Retrieves the appropriate transmogrifier class based on the active event plugin.
*
* @return string|null The transmogrifier class name or null if not available.
*/ */
public static function get_transmogrifier() { public static function get_transmogrifier() {
// Retrieve singleton instance.
$setup = self::get_instance(); $setup = self::get_instance();
$event_sources_active = get_option( 'event_bridge_for_activitypub_event_sources_active', false ); // Get plugin options.
$event_sources_active = (bool) get_option( 'event_bridge_for_activitypub_event_sources_active', false );
$event_plugin = get_option( 'event_bridge_for_activitypub_plugin_used_for_event_source_feature', '' ); $event_plugin = get_option( 'event_bridge_for_activitypub_plugin_used_for_event_source_feature', '' );
if ( ! $event_sources_active || ! $event_plugin ) { // Bail out if event sources are not active or no plugin is specified.
return; if ( ! $event_sources_active || empty( $event_plugin ) ) {
return null;
} }
// Get the list of active event plugins.
$active_event_plugins = $setup->get_active_event_plugins(); $active_event_plugins = $setup->get_active_event_plugins();
// Loop through active plugins to find a match.
foreach ( $active_event_plugins as $active_event_plugin ) { foreach ( $active_event_plugins as $active_event_plugin ) {
if ( strrpos( $active_event_plugin::class, $event_plugin ) ) { // Retrieve the class name of the active plugin.
return $active_event_plugin::get_transmogrifier_class(); $active_plugin_class = get_class( $active_event_plugin );
// Check if the active plugin class name contains the specified event plugin name.
if ( false !== strpos( $active_plugin_class, $event_plugin ) ) {
// Return the transmogrifier class provided by the plugin.
return $active_event_plugin->get_transmogrifier_class();
} }
} }
// Return null if no matching plugin is found.
return null;
} }
} }