Skip to content

Commit

Permalink
Update share setting (#36953)
Browse files Browse the repository at this point in the history
* add debug

* changelog

* check if submenu exists

* remove debug

* fix lint

* fix visited button style

* Use array_reduce to iterate through submenu items in case the order changes

* only apply style to button-primary
  • Loading branch information
eoigal authored Apr 18, 2024
1 parent 5fe8c38 commit ca2ad4e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/update-share-setting
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Minor fix to share settings where showing link that doesn't always exist in jeptack menu


3 changes: 3 additions & 0 deletions projects/plugins/jetpack/modules/sharedaddy/admin-sharing.css
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ body.settings_page_sharing .advanced input[type=submit] {
margin-right:1rem;
}

.sharing-block-message__buttons-wrapper .button-primary:visited {
color: #fff;
}

.admin-sharing-settings__block-theme-description {
margin-top: 1rem;
Expand Down
12 changes: 12 additions & 0 deletions projects/plugins/jetpack/modules/sharedaddy/sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,16 @@ public function sharing_block_display() {
new Share_Email( 'email', array() ),
new Share_Reddit( 'reddit', array() ),
);

global $submenu;
// Hide the link to Jetpack Sharing settings if no Jetpack Settings found in submenu list
$show_jetpack_admin_settings_link = array_reduce(
$submenu['jetpack'],
function ( $carry, $item ) {
return $carry || ( isset( $item[2] ) && $item[2] === 'jetpack#/settings' );
},
false
);
?>

<div class="share_manage_options">
Expand Down Expand Up @@ -752,6 +762,7 @@ public function sharing_block_display() {
</div>
</div>
</div>
<?php if ( $show_jetpack_admin_settings_link ) : ?>
<p class="settings-sharing__block-theme-description">
<?php
printf(
Expand All @@ -766,6 +777,7 @@ public function sharing_block_display() {
);
?>
</p>
<?php endif; ?>
</div>
<br class="clearing" />
</div>
Expand Down

0 comments on commit ca2ad4e

Please sign in to comment.