Merge pull request #18895 from woocommerce/fix/remove-attribute-type-column
Remove "Type" column on attributes table by default.
This commit is contained in:
commit
e903027c2f
|
@ -221,9 +221,7 @@ class WC_Admin_Attributes {
|
|||
* `product_attributes_type_selector` filter. If there is only the default type registered,
|
||||
* this setting will be hidden.
|
||||
*/
|
||||
$attribute_types = wc_get_attribute_types();
|
||||
|
||||
if ( 1 < count( $attribute_types ) || ! array_key_exists( 'select', $attribute_types ) ) {
|
||||
if ( wc_has_custom_attribute_types() ) {
|
||||
?>
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row" valign="top">
|
||||
|
@ -294,7 +292,9 @@ class WC_Admin_Attributes {
|
|||
<tr>
|
||||
<th scope="col"><?php esc_html_e( 'Name', 'woocommerce' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
|
||||
<?php if ( wc_has_custom_attribute_types() ) : ?>
|
||||
<th scope="col"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
|
||||
<?php endif; ?>
|
||||
<th scope="col"><?php esc_html_e( 'Order by', 'woocommerce' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Terms', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
|
@ -310,7 +310,9 @@ class WC_Admin_Attributes {
|
|||
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ) ); ?>"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></span></div>
|
||||
</td>
|
||||
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
|
||||
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? esc_html__( '(Public)', 'woocommerce' ) : ''; ?></td>
|
||||
<?php if ( wc_has_custom_attribute_types() ) : ?>
|
||||
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? esc_html__( '(Public)', 'woocommerce' ) : ''; ?></td>
|
||||
<?php endif; ?>
|
||||
<td><?php
|
||||
switch ( $tax->attribute_orderby ) {
|
||||
case 'name' :
|
||||
|
@ -405,9 +407,7 @@ class WC_Admin_Attributes {
|
|||
* `product_attributes_type_selector` filter. If there is only the default type registered,
|
||||
* this setting will be hidden.
|
||||
*/
|
||||
$attribute_types = wc_get_attribute_types();
|
||||
|
||||
if ( 1 < count( $attribute_types ) || ! array_key_exists( 'select', $attribute_types ) ) {
|
||||
if ( wc_has_custom_attribute_types() ) {
|
||||
?>
|
||||
<div class="form-field">
|
||||
<label for="attribute_type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></label>
|
||||
|
|
|
@ -197,6 +197,18 @@ function wc_get_attribute_types() {
|
|||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there are custom attribute types.
|
||||
*
|
||||
* @since 3.3.2
|
||||
* @return bool True if there are custom types, otherwise false.
|
||||
*/
|
||||
function wc_has_custom_attribute_types() {
|
||||
$types = wc_get_attribute_types();
|
||||
|
||||
return 1 < count( $types ) || ! array_key_exists( 'select', $types );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attribute type label.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue