Skip to content

Commit

Permalink
Consistancy of icon type setting
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc committed Nov 30, 2023
1 parent 6e7529c commit 1e476ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions includes/MslsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,14 @@ public function render() {
* @return string
*/
public function subsubsub() {
$arr = [];
$icon_type = $this->options->get_icon_type();

$arr = [];
foreach ( $this->collection->get_plugin_active_blogs() as $blog ) {
$admin_url = get_admin_url( $blog->userblog_id, $this->get_options_page_link() );
$current = $blog->userblog_id == $this->collection->get_current_blog_id() ? ' class="current"' : '';

$arr[] = sprintf( '<a href="%1$s"%2$s>%3$s</a>', $admin_url, $current, $blog->get_title() );
$arr[] = sprintf( '<a href="%1$s"%2$s>%3$s</a>', $admin_url, $current, $blog->get_title( $icon_type ) );
}

return empty( $arr ) ? '' : sprintf( '<ul class="subsubsub"><li>%s</li></ul>', implode( ' | </li><li>', $arr ) );
Expand Down
9 changes: 9 additions & 0 deletions includes/MslsOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,13 @@ public static function check_for_blog_slug( $url, $options ) {
return home_url( $url );
}

/**
* Get the icon type by the settings saved in admin_display
*
* @return string
*/
public function get_icon_type(): string {
return MslsAdminIcon::TYPE_LABEL === $this->admin_display ? MslsAdminIcon::TYPE_LABEL : MslsAdminIcon::TYPE_FLAG;
}

}
2 changes: 1 addition & 1 deletion includes/MslsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static function get_output() {
* @return void
*/
public static function update_adminbar( \WP_Admin_Bar $wp_admin_bar ): void {
$icon_type = MslsAdminIcon::TYPE_LABEL === MslsOptions::instance()->admin_display ? MslsAdminIcon::TYPE_LABEL : MslsAdminIcon::TYPE_FLAG;
$icon_type = MslsOptions::instance()->get_icon_type();

$blog_collection = MslsBlogCollection::instance();
foreach ( $blog_collection->get_plugin_active_blogs() as $blog ) {
Expand Down

0 comments on commit 1e476ea

Please sign in to comment.