ac/column/value

This filters alters the value for a column. Check if you have the correct column to your disposal and return the altered value.
Filter ac/column/value

Usage

/**
 * Filter the display value for a column
 *
 * @param mixed $value Custom field value
 * @param int $id Object ID
 * @param AC_Column $column Column instance
 */
function ac_filter_column_value( $value, $id, $column ){

	// Check for specific column by using the methods in AC_Column and alter the value

	return $value;
}
add_filter( 'ac/column/value', 'ac_filter_column_value', 10, 3 );

Examples

This example shows how to alter the value for an Advanced Custom Fields column. Just use the defined variables als you like and remove the unused variables.

/**
 * @param $value  string
 * @param $id     int
 * @param $column AC_Column
 */
function ac_my_acf_column_value_example( $value, $id, $column ) {
	if ( $column instanceof ACA_ACF_Column ) {
		$meta_key = $column->get_meta_key(); // This gets the ACF field key
		$acf_field = $column->get_acf_field(); // Gets an ACF object
		$acf_type =  $column->get_acf_field_option( 'type' ); // Get the ACF field type

		if( 'text' == $acf_type  ){
			// Alter the display $value
			$value = 'NEWVALUE';
		}
	}

	return $value;
}

add_filter( 'ac/column/value', 'ac_my_acf_column_value_example', 10, 3 );

The following example shows how to alter a Custom Field columns value based on the used custom field.

/**
 * @param $value  string
 * @param $id     int
 * @param $column AC_Column
 */
function ac_my_custom_field_column_value_example( $value, $id, $column ) {
	if ( $column instanceof ACP_Column_CustomField ) {
		$meta_key = $column->get_meta_key(); // This gets the Custom Field key

		if ( 'my_color' == $meta_key ) {
			// Use the color
			$value = sprintf( '<span style="color: %1$s;">%1$s</span>', $value );
		}
	}

	return $value;
}

add_filter( 'ac/column/value', 'ac_my_custom_field_column_value_example', 10, 3 );

The following example check for a specific column and prepends a string for the ID column.

/**
 * @param $value  string
 * @param $id     int
 * @param $column AC_Column
 */
function ac_my_ID_column_value_example( $value, $id, $column ) {
	// Prepend a string for the Custom ID column
	if ( 'column-postid' === $column->get_type() ) {
		$value = 'PostID: ' . $id;
	}

	return $value;
}

add_filter( 'ac/column/value', 'ac_my_ID_column_value_example', 10, 3 );

Legacy

The following filters are replaced by ac/column/value since Admin Columns Pro 4.0.
cac/column/meta/value
cac/column/meta/value
cac/column/value
cac/column/value/{$type}