Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add none option to loading of tokens #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ public function nlds_community_blocks_render_token_select() {
$nlds_community_blocks_municipalities[ $ncb_community ] = ucfirst( $ncb_community );
}

// Add a none option.
$nlds_community_blocks_municipalities['none'] = esc_html__( 'None', 'nlds-community-blocks' );

// Output the field.
foreach ( $nlds_community_blocks_municipalities as $value => $label ) {
echo '<label><input type="radio" name="ncb_municipality" value="' . esc_attr( $value ) . '" ' . checked( $value, $ncb_selected_municipality, false ) . '> ' . esc_html( $label ) . '</label><br/>';
Expand Down
2 changes: 1 addition & 1 deletion frontend/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function enqueue_block_assets() {
}

$ncb_theme = esc_attr( get_option( 'ncb_municipality', 'denhaag' ) );
if ( ! empty( $ncb_theme ) && Plugin::has_resource( NCB_ABSPATH . NCB_ASSETS_DIR . "client/tokens/ncb-$ncb_theme-tokens.css" ) ) {
if ( ! empty( $ncb_theme ) && 'none' !== $ncb_theme && Plugin::has_resource( NCB_ABSPATH . NCB_ASSETS_DIR . "client/tokens/ncb-$ncb_theme-tokens.css" ) ) {
Copy link
Author

@YvetteNikolov YvetteNikolov Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deze extra check is eigenlijk niet nodig aangezien client/tokens/ncb-none-tokens.css niet bestaat, maar dit maakt het wel extra verbose.

Hoor het wel of je deze erin wilt houden.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wp_enqueue_style(
"ncb-$ncb_theme-tokens",
ncb_mix( "client/tokens/ncb-$ncb_theme-tokens.css" ),
Expand Down
Loading