Inventory_Presser_Customize_Admin_Dashboard::__construct( $post_type )


Source

File: includes/class-customize-admin-dashboard.php

	/**
	 * add_vehicles_to_admin_bar
	 * 
	 * Adds a Vehicle button to the Admin Bar
	 *
	 * @return void
	 */
	function add_vehicles_to_admin_bar()
	{
		//do not do this if we are already looking at the dashboard
		if( is_admin() ) { return; }

		global $wp_admin_bar;
		$wp_admin_bar->add_node( array(
			'id'     => 'wp-admin-bar-vehicles',
			'title'  => __( 'Vehicles', 'inventory-presser' ),
			'href'   => admin_url( 'edit.php?post_type=' . INVP::POST_TYPE ),
			'parent' => 'site-name',
		) );
	}
	
	/**
	 * annotate_add_media_button
	 * 
	 * Adds HTML near the Add Media button on the classic editor.
	 *
	 * @param  mixed $editor_id
	 * @return void
	 */
	function annotate_add_media_button( $editor_id )
	{
		if( 'content' != $editor_id ) { return; }

		printf(
			'%s<span id="media-annotation" class="annotation">%s</span>',
			$this->create_delete_all_post_attachments_button(),
			$this->create_add_media_button_annotation()
		);
	}

	/**
	 * array_to_csv
	 * 
	 * Converts a one-dimensional array into an equivalent comma-separated v
	 * values string. Input of array( 1, 2, 3 ) returns "1","2","3"
	 *
	 * @param  array $arr
	 * @return string
	 */
	private function array_to_csv( $arr )
	{
		$csv = '';
		foreach( $arr as $item )
		{
			$csv .= "\"" . str_replace( "\"", "\"\"", $item ) . "\",";
		}
		//ignore last comma