ACF_Location_Attachment::get_values
Returns an array of possible values for this rule type.
Method of the class: ACF_Location_Attachment{}
No Hooks.
Returns
Array.
Usage
$ACF_Location_Attachment = new ACF_Location_Attachment(); $ACF_Location_Attachment->get_values( $rule );
- $rule(array) (required)
- A location rule.
Changelog
| Since 5.9.0 | Introduced. |
ACF_Location_Attachment::get_values() ACF Location Attachment::get values code ACF 6.0.4
public function get_values( $rule ) {
$choices = array(
'all' => __( 'All', 'acf' ),
);
// Get mime types and append into optgroups.
$mime_types = get_allowed_mime_types();
foreach ( $mime_types as $regex => $mime_type ) {
// Get type "image" from mime_type "image/jpeg".
$type = current( explode( '/', $mime_type ) );
// Append group and mimetype.
$choices[ $type ][ $type ] = sprintf( __( 'All %s formats', 'acf' ), $type );
$choices[ $type ][ $mime_type ] = "$regex ($mime_type)";
}
// return
return $choices;
}