',
(int) $size,
esc_attr( $id )
);
}
/**
* The mark alone, to open a screen's heading: inside the , before its text, so the two share
* a line. It links to the Adminkeep settings only for a user who can open them; an editor on the
* Order screen gets the bare mark instead of a link that would refuse them. The name is kept
* for screen readers and as the tooltip.
*
* Given the id of the feature that owns the screen, the link opens that feature's own panel
* (the settings script routes from the address's #fragment), which is where someone looking
* at the screen wants to go. With no id, or one no feature has, it opens the overview.
*
* @param string $feature_id Id of the feature that owns the screen.
* @return string Escaped markup.
*/
public static function heading_mark( $feature_id = '' ) {
$style = 'display:inline-block;margin-right:8px;line-height:0;vertical-align:-4px;';
$label = '' . esc_html__( 'Adminkeep', 'adminkeep' ) . '';
if ( current_user_can( SettingsPage::CAPABILITY ) ) {
$url = SettingsPage::url();
$title = __( 'Adminkeep settings', 'adminkeep' );
$feature = '' === $feature_id ? null : \Adminkeep\Plugin::instance()->registry()->get( $feature_id );
if ( null !== $feature ) {
$url .= '#' . $feature->id();
/* translators: %s: a feature's name, such as "Email Log". */
$title = sprintf( __( '%s settings', 'adminkeep' ), $feature->label() );
}
return sprintf(
'%4$s',
esc_url( $url ),
esc_attr( $title ),
esc_attr( $style ),
self::mark( 24 ) . $label
);
}
return sprintf(
'%3$s',
esc_attr__( 'Adminkeep', 'adminkeep' ),
esc_attr( $style ),
self::mark( 24 ) . $label
);
}
}