php/WP_CLI/Formatter.php
private function show_single_field( $items, $field ) {
		$key    = null;
		$values = array();

		foreach ( $items as $item ) {
			$item = (object) $item;

			if ( null === $key ) {
				$key = $this->find_item_key( $item, $field );
			}

			if ( 'json' === $this->args['format'] ) {
				$values[] = $item->$key;
			} else {
				\WP_CLI::print_value(
					$item->$key,
					array(
						'format' => $this->args['format'],
					)
				);
			}
		}

		if ( 'json' === $this->args['format'] ) {
			echo json_encode( $values );
		}
	}
private function show_single_field( $items, $field ) {
		$key    = null;
		$values = array();

		foreach ( $items as $item ) {
			$item = (object) $item;

			if ( null === $key ) {
				$key = $this->find_item_key( $item, $field );
			}

			if ( 'json' === $this->args['format'] ) {
				$values[] = $item->$key;
			} else {
				\WP_CLI::print_value(
					$item->$key,
					array(
						'format' => $this->args['format'],
					)
				);
			}
		}

		if ( 'json' === $this->args['format'] ) {
			echo json_encode( $values );
		}
	}
private function show_single_field ( $ items , $ field ) { $ key = null ; $ values = array ( ) ; foreach ( $ items as $ item ) { $ item = ( object ) $ item ; if ( null === $ key ) { $ key = $ this -> find_item_key ( $ item , $ field ) ; } if ( 'json' === $ this -> args [ 'format' ] ) { $ values [ ] = $ item -> $ key ; } else { \ WP_CLI :: print_value ( $ item -> $ key , array ( 'format' => $ this -> args [ 'format' ] , ) ) ; } } if ( 'json' === $ this -> args [ 'format' ] ) { echo json_encode ( $ values ) ; } }
Show a single field from a list of items.

@param array Array of objects to show fields from
@param string The field to show
Show a single field from a list of items .