Command::get_formatter( array $assoc_args )

Get Formatter object based on supplied parameters.


Parameters Parameters

$assoc_args

(array) (Required) Parameters passed to command. Determines formatting.


Top ↑

Return Return

(WP_CLIFormatter)


Top ↑

Source Source

File: libraries/lifterlms-cli/src/Commands/Restful/Command.php

	protected function get_formatter( &$assoc_args ) {
		if ( ! empty( $assoc_args['fields'] ) ) {
			if ( is_string( $assoc_args['fields'] ) ) {
				$fields = explode( ',', $assoc_args['fields'] );
			} else {
				$fields = $assoc_args['fields'];
			}
		} else {
			if ( ! empty( $assoc_args['context'] ) ) {
				$fields = $this->get_context_fields( $assoc_args['context'] );
			} else {
				$fields = $this->get_context_fields( 'view' );
			}
		}
		return new \WP_CLI\Formatter( $assoc_args, $fields );
	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.