WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Admin_Attributes::edit_attribute() public WC 1.0

Edit Attribute admin panel.

Shows the interface for changing an attributes type between select and text.

Это метод класса: WC_Admin_Attributes{}

Возвращает

Null. Ничего.

Использование

$result = WC_Admin_Attributes::edit_attribute();

Код WC_Admin_Attributes::edit_attribute() WC 4.5.2

woocommerce/includes/admin/class-wc-admin-attributes.php
<?php
public static function edit_attribute() {
	global $wpdb;

	$edit = isset( $_GET['edit'] ) ? absint( $_GET['edit'] ) : 0;

	$attribute_to_edit = $wpdb->get_row(
		$wpdb->prepare(
			"
			SELECT attribute_type, attribute_label, attribute_name, attribute_orderby, attribute_public
			FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = %d
			",
			$edit
		)
	);

	?>
	<div class="wrap woocommerce">
		<h1><?php esc_html_e( 'Edit attribute', 'woocommerce' ); ?></h1>

		<?php
		if ( ! $attribute_to_edit ) {
			echo '<div id="woocommerce_errors" class="error"><p>' . esc_html__( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>';
		} else {
			if ( self::$edited_attribute_id > 0 ) {
				echo '<div id="message" class="updated"><p>' . esc_html__( 'Attribute updated successfully', 'woocommerce' ) . '</p><p><a href="' . esc_url( admin_url( 'edit.php?post_type=product&amp;page=product_attributes' ) ) . '">' . esc_html__( 'Back to Attributes', 'woocommerce' ) . '</a></p></div>';
				self::$edited_attribute_id = null;
			}
			$att_type    = $attribute_to_edit->attribute_type;
			$att_label   = format_to_edit( $attribute_to_edit->attribute_label );
			$att_name    = $attribute_to_edit->attribute_name;
			$att_orderby = $attribute_to_edit->attribute_orderby;
			$att_public  = $attribute_to_edit->attribute_public;
			?>
			<form action="edit.php?post_type=product&amp;page=product_attributes&amp;edit=<?php echo absint( $edit ); ?>" method="post">
				<table class="form-table">
					<tbody>
						<?php do_action( 'woocommerce_before_edit_attribute_fields' ); ?>
						<tr class="form-field form-required">
							<th scope="row" valign="top">
								<label for="attribute_label"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
							</th>
							<td>
								<input name="attribute_label" id="attribute_label" type="text" value="<?php echo esc_attr( $att_label ); ?>" />
								<p class="description"><?php esc_html_e( 'Name for the attribute (shown on the front-end).', 'woocommerce' ); ?></p>
							</td>
						</tr>
						<tr class="form-field form-required">
							<th scope="row" valign="top">
								<label for="attribute_name"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></label>
							</th>
							<td>
								<input name="attribute_name" id="attribute_name" type="text" value="<?php echo esc_attr( $att_name ); ?>" maxlength="28" />
								<p class="description"><?php esc_html_e( 'Unique slug/reference for the attribute; must be no more than 28 characters.', 'woocommerce' ); ?></p>
							</td>
						</tr>
						<tr class="form-field form-required">
							<th scope="row" valign="top">
								<label for="attribute_public"><?php esc_html_e( 'Enable archives?', 'woocommerce' ); ?></label>
							</th>
							<td>
								<input name="attribute_public" id="attribute_public" type="checkbox" value="1" <?php checked( $att_public, 1 ); ?> />
								<p class="description"><?php esc_html_e( 'Enable this if you want this attribute to have product archives in your store.', 'woocommerce' ); ?></p>
							</td>
						</tr>
						<?php
						/**
						 * Attribute types can change the way attributes are displayed on the frontend and admin.
						 *
						 * By Default WooCommerce only includes the `select` type. Others can be added with the
						 * `product_attributes_type_selector` filter. If there is only the default type registered,
						 * this setting will be hidden.
						 */
						if ( wc_has_custom_attribute_types() ) {
							?>
							<tr class="form-field form-required">
								<th scope="row" valign="top">
									<label for="attribute_type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></label>
								</th>
								<td>
									<select name="attribute_type" id="attribute_type">
										<?php foreach ( wc_get_attribute_types() as $key => $value ) : ?>
											<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $att_type, $key ); ?>><?php echo esc_html( $value ); ?></option>
										<?php endforeach; ?>
										<?php
											/**
											 * Deprecated action in favor of product_attributes_type_selector filter.
											 *
											 * @todo Remove in 4.0.0
											 * @deprecated 2.4.0
											 */
											do_action( 'woocommerce_admin_attribute_types' );
										?>
									</select>
									<p class="description"><?php esc_html_e( "Determines how this attribute's values are displayed.", 'woocommerce' ); ?></p>
								</td>
							</tr>
							<?php
						}
						?>
						<tr class="form-field form-required">
							<th scope="row" valign="top">
								<label for="attribute_orderby"><?php esc_html_e( 'Default sort order', 'woocommerce' ); ?></label>
							</th>
							<td>
								<select name="attribute_orderby" id="attribute_orderby">
									<option value="menu_order" <?php selected( $att_orderby, 'menu_order' ); ?>><?php esc_html_e( 'Custom ordering', 'woocommerce' ); ?></option>
									<option value="name" <?php selected( $att_orderby, 'name' ); ?>><?php esc_html_e( 'Name', 'woocommerce' ); ?></option>
									<option value="name_num" <?php selected( $att_orderby, 'name_num' ); ?>><?php esc_html_e( 'Name (numeric)', 'woocommerce' ); ?></option>
									<option value="id" <?php selected( $att_orderby, 'id' ); ?>><?php esc_html_e( 'Term ID', 'woocommerce' ); ?></option>
								</select>
								<p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
							</td>
						</tr>
						<?php do_action( 'woocommerce_after_edit_attribute_fields' ); ?>
					</tbody>
				</table>
				<p class="submit"><button type="submit" name="save_attribute" id="submit" class="button-primary" value="<?php esc_attr_e( 'Update', 'woocommerce' ); ?>"><?php esc_html_e( 'Update', 'woocommerce' ); ?></button></p>
				<?php wp_nonce_field( 'woocommerce-save-attribute_' . $edit ); ?>
			</form>
		<?php } ?>
	</div>
	<?php
}