acf_get_view()
This function will load in a file from the 'admin/views' folder and allow variables to be passed through
No Hooks.
Returns
null. Nothing (null).
Usage
acf_get_view( $view_path, $view_args );
- $view_path(string)
- .
Default:'' - $view_args(array)
- .
Default:array()
Changelog
| Since 5.0.0 | Introduced. |
acf_get_view() acf get view code ACF 6.8.8
function acf_get_view( $view_path = '', $view_args = array() ) {
// allow view file name shortcut
if ( substr( $view_path, -4 ) !== '.php' ) {
$view_path = acf_get_path( "includes/admin/views/{$view_path}.php" );
}
// include
if ( file_exists( $view_path ) ) {
// Use `EXTR_SKIP` here to prevent `$view_path` from being accidentally/maliciously overridden.
extract( $view_args, EXTR_SKIP );
include $view_path;
}
}