defaults, $field);
// value must be array
if( !is_array($field['value']) ){
// perhaps this is a default value with new lines in it?
if( strpos($field['value'], "\n") !== false ){
// found multiple lines, explode it
$field['value'] = explode("\n", $field['value']);
}else{
$field['value'] = array( $field['value'] );
}
}
// trim value
$field['value'] = array_map('trim', $field['value']);
if(!is_multisite()){
echo '
' . __('You need to have set up a multisite network for this field to work', 'acf_sites') . '
' . __('No sites found, check your filter settings in the acf field', 'acf_sites') . '
';
}
}
}
/*--------------------------------------------------------------------------------------
*
* admin_print_scripts / admin_print_styles
* - this function is called in the admin_print_scripts / admin_print_styles where
* your field is created. Use this function to register css and javascript to assist
* your create_field() function.
*
* @author Elliot Condon
* @since 3.0.0
*
*-------------------------------------------------------------------------------------*/
function admin_print_styles()
{
// Note: This function can be removed if not used
wp_register_style('acf-input-blogs', $this->settings['dir'] . 'css/input.css', array('acf-input'), $this->settings['version']);
// styles
wp_enqueue_style(array(
'acf-input-blogs',
));
}
/*--------------------------------------------------------------------------------------
*
* get_value_for_api
* - called from your template file when using the API functions (get_field, etc).
* This function is useful if your field needs to format the returned value
*
* @params
* - $post_id (int) - the post ID which your value is attached to
* - $field (array) - the field object.
*
* @author Elliot Condon
* @since 3.0.0
*
*-------------------------------------------------------------------------------------*/
function get_value_for_api($post_id, $field)
{
// Note: This function can be removed if not used
// get value
$value = $this->get_value($post_id, $field);
// defaults?
$field = array_merge($this->defaults, $field);
// make sure even select returns an array, for consistency!
$checkbox_select = $field['checkbox_select'];
$value = ($checkbox_select == 'select' ? array($value) : $value);
// return value
return $value;
}
}
?>