Skip to content

Commit

Permalink
Merge pull request #14353 from jeabakker/fixes-5
Browse files Browse the repository at this point in the history
fix(plugins): correct layout when a plugin can't be (de)activated
  • Loading branch information
jdalsem committed Jun 1, 2023
2 parents 2ef9006 + 35a3623 commit 6813c9b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions views/default/object/plugin/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
return;
}

/* @var ElggPlugin $plugin */
$plugin = elgg_extract('entity', $vars);
if (!$plugin instanceof \ElggPlugin) {
return;
}

$reordering = elgg_extract('display_reordering', $vars, false);
$active = $plugin->isActive();

Expand Down Expand Up @@ -42,7 +45,7 @@

// activate / deactivate button
$options = [
'is_action' => true,
'href' => false,
];

if ($active) {
Expand All @@ -57,8 +60,7 @@
$classes[] = 'elgg-state-cannot-deactivate';

$options['title'] = elgg_echo('admin:plugins:cannot_deactivate');
$options['class'] = 'elgg-button elgg-button-cancel';
$options['disabled'] = true;
$options['class'] = 'elgg-button elgg-button-cancel elgg-state-disabled';
}
} else if ($can_activate) {
$classes[] = 'elgg-state-inactive';
Expand All @@ -72,9 +74,8 @@
$classes[] = 'elgg-state-cannot-activate';

$options['title'] = elgg_echo('admin:plugins:cannot_activate');
$options['class'] = 'elgg-button elgg-button-submit';
$options['class'] = 'elgg-button elgg-button-submit elgg-state-disabled';
$options['text'] = elgg_echo('admin:plugins:activate');
$options['disabled'] = true;
}

$action_button = elgg_trigger_event_results('action_button', 'plugin', ['entity' => $plugin], elgg_view('output/url', $options));
Expand Down

0 comments on commit 6813c9b

Please sign in to comment.