Skip to content

Commit

Permalink
QTS: remove slug fields for WC attributes add/edit page
Browse files Browse the repository at this point in the history
Slugs fields from WC attribute add/edit admin pages are replaced with the link to the relevant existing slugs module settings page.
  • Loading branch information
spleen1981 committed May 9, 2022
1 parent 0811c33 commit 9f4e5fb
Showing 1 changed file with 36 additions and 2 deletions.
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' ) );
?>
</td>
</tr>
<?php
}

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

0 comments on commit 9f4e5fb

Please sign in to comment.