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

QTS: remove slug fields for WC attributes add/edit page #1164

Merged
merged 1 commit into from
May 13, 2022
Merged
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
38 changes: 36 additions & 2 deletions modules/slugs/includes/qtranslate-slug-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function qts_taxonomies_hooks() {
}

if ( QTX_Module_Loader::is_module_active( 'woo-commerce' ) ) {
add_action( 'woocommerce_after_add_attribute_fields', 'qts_show_add_term_fields' );
add_action( 'woocommerce_after_edit_attribute_fields', 'qts_show_edit_term_fields' );
add_action( 'woocommerce_after_add_attribute_fields', 'qts_show_add_taxonomy_slugs_option_link' );
add_action( 'woocommerce_after_edit_attribute_fields', 'qts_show_edit_taxonomy_slugs_option_link' );
}
}

Expand Down Expand Up @@ -430,6 +430,40 @@ function qts_show_edit_term_fields( $term ) {
<?php
}

/**
* Display link to slugs settings for add custom tax admin page (e.g. WooCommerce product attributes).
*
*/
function qts_show_add_taxonomy_slugs_option_link() {
?>
<div class="form-field term-slug-wrap">
<label><?php _e( 'Slugs per language', 'qtranslate' ) ?></label>
<?php
//TODO: link destination should not be hardcoded here, but currently $options_uri property is private in QTX_Admin_Settings class (base options page) and module id is hardcoded independently from module definitions in QTX_Admin_Module class (module href).
echo sprintf( "<p>" . __( 'Multilanguage slugs can be set up in <a href="%s">slugs module settings</a> once the new item is added.', 'qtranslate' ) . "</p>", admin_url( 'options-general.php?page=qtranslate-xt#slugs' ) );
?>
</div>
<?php
}

/**
* Display link to slugs settings for edit custom tax admin page (e.g. WooCommerce product attributes).
*
*/
function qts_show_edit_taxonomy_slugs_option_link() {
?>
<tr class="form-field term-slug-wrap">
<th><?php _e( 'Slugs per language', 'qtranslate' ) ?></th>
<td>
<?php
//TODO: link destination should not be hardcoded here, but currently $options_uri property is private in QTX_Admin_Settings class (base options page) and module id is hardcoded independently from module definitions in QTX_Admin_Module class (module href).
echo sprintf( "<p>" . __( 'Multilanguage slugs can be set up in <a href="%s">slugs module settings</a>', 'qtranslate' ) . "</p>", admin_url( 'options-general.php?page=qtranslate-xt#slugs' ) );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe i'm missing something, but I don't find the product attributes in the settings.
I can find the product categories and tags, but not the attributes 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You need this check enabled in your test attribute, otherwise there is no archive page and no slug needed.
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good to now!

?>
</td>
</tr>
<?php
}

/**
* Hide automatically the wordpress slug box in edit terms page.
*/
Expand Down