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

Add support for togglable "Advanced Settings" in download file metabox row #9583

Closed
wants to merge 1 commit into from

Conversation

arraypress
Copy link
Contributor

Fixes #9261

Added supported for "advanced settings" in the file metabox row. This was needed as I need to allow the ability to add settings on a per file basis and the row option wasn't a good option from a UX perspective.

See an example of it working here:

Screenshot 2022-11-17 at 01 53 23

Please do not submit PRs with minified CSS or JS files. This is managed at the time of release by the Core Team

$variable_pricing = edd_has_variable_prices( $post_id );
$variable_display = $variable_pricing ? '' : ' style="display:none;"';
$variable_class = $variable_pricing ? ' has-variable-pricing' : '';
$custom_file_options = isset( $wp_filter['edd_download_file_option_row'] ) ? true : false; ?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$custom_file_options = isset( $wp_filter['edd_download_file_option_row'] ) ? true : false; ?>
$custom_file_options = has_action( 'edd_download_file_option_row' );
?>

And the global can be removed from line 803. Also please fix the alignment/spaces in the previous variables (some tabs have gotten mixed in).

<?php
$actions = array();
if ( $custom_file_options ) {
$actions['show_advanced'] = '<a href="#" class="toggle-custom-price-option-section">' . __( 'Show advanced settings', 'easy-digital-downloads' ) . '</a>';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$actions['show_advanced'] = '<a href="#" class="toggle-custom-price-option-section">' . __( 'Show advanced settings', 'easy-digital-downloads' ) . '</a>';
$actions['show_advanced'] = '<a class="toggle-custom-price-option-section">' . __( 'Show advanced settings', 'easy-digital-downloads' ) . '</a>';

This really should be a button instead of a link but I know this is following the pattern set by the existing "button"...but the href should be removed, pending fixing all of the buttons in the metaboxes.

if ( $custom_file_options ) {
?>

<div class="edd-custom-price-option-sections-wrap">
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is using the class that it is to inherit the JS behavior without needing to modify the JS, but I would suggest adding an additional file specific class here so that it's a little less confusing when reading the code/markup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robincornett I actually badly hurt my hand at the weekend, so typing (and coding) is a pain. Would you be able to make the required changes here please? Would help me a lot, as I am taking a break from coding until my hand recovers (also upgrading my mouse and keyboard to help).

@cklosowski cklosowski deleted the branch awesomemotive:release/3.1.0.3 November 23, 2022 23:40
@cklosowski cklosowski closed this Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Show advance settings" support to the file download rows
3 participants