CMB2 Documentation
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hooks
  • Download Docs
  • Github

Packages

  • CMB2
  • Demo
    • CMB2
  • None
  • Tests
    • CMB2

Classes

  • CMB2
  • CMB2_Ajax
  • CMB2_Base
  • CMB2_Bootstrap_2101
  • CMB2_Boxes
  • CMB2_Display_Checkbox
  • CMB2_Display_Colorpicker
  • CMB2_Display_File
  • CMB2_Display_File_List
  • CMB2_Display_Multicheck
  • CMB2_Display_oEmbed
  • CMB2_Display_Select
  • CMB2_Display_Taxonomy_Multicheck
  • CMB2_Display_Taxonomy_Radio
  • CMB2_Display_Text_Date
  • CMB2_Display_Text_Date_Timezone
  • CMB2_Display_Text_Money
  • CMB2_Display_Text_Time
  • CMB2_Display_Text_Url
  • CMB2_Display_Textarea
  • CMB2_Display_Textarea_Code
  • CMB2_Field
  • CMB2_Field_Display
  • CMB2_Hookup
  • CMB2_Hookup_Base
  • CMB2_JS
  • CMB2_Option
  • CMB2_Options
  • CMB2_Options_Hookup
  • CMB2_REST
  • CMB2_REST_Controller
  • CMB2_REST_Controller_Boxes
  • CMB2_REST_Controller_Fields
  • CMB2_Sanitize
  • CMB2_Show_Filters
  • CMB2_Type_Base
  • CMB2_Type_Checkbox
  • CMB2_Type_Colorpicker
  • CMB2_Type_Counter_Base
  • CMB2_Type_File
  • CMB2_Type_File_Base
  • CMB2_Type_File_List
  • CMB2_Type_Multi_Base
  • CMB2_Type_Multicheck
  • CMB2_Type_Oembed
  • CMB2_Type_Picker_Base
  • CMB2_Type_Radio
  • CMB2_Type_Select
  • CMB2_Type_Select_Timezone
  • CMB2_Type_Taxonomy_Base
  • CMB2_Type_Taxonomy_Multicheck
  • CMB2_Type_Taxonomy_Multicheck_Hierarchical
  • CMB2_Type_Taxonomy_Radio
  • CMB2_Type_Taxonomy_Radio_Hierarchical
  • CMB2_Type_Taxonomy_Select
  • CMB2_Type_Taxonomy_Select_Hierarchical
  • CMB2_Type_Text
  • CMB2_Type_Text_Date
  • CMB2_Type_Text_Datetime_Timestamp
  • CMB2_Type_Text_Datetime_Timestamp_Timezone
  • CMB2_Type_Text_Time
  • CMB2_Type_Textarea
  • CMB2_Type_Textarea_Code
  • CMB2_Type_Title
  • CMB2_Type_Wysiwyg
  • CMB2_Types
  • CMB2_Utils
  • Test_CMB2_Utils_WIN

Functions

  • _tests_cmb2_manually_load_plugin
  • cmb2_ajax
  • cmb2_autoload_classes
  • cmb2_bootstrap
  • cmb2_dir
  • cmb2_do_oembed
  • cmb2_get_field
  • cmb2_get_field_value
  • cmb2_get_metabox
  • cmb2_get_metabox_form
  • cmb2_get_metabox_sanitized_values
  • cmb2_get_oembed
  • cmb2_get_option
  • cmb2_metabox_form
  • cmb2_options
  • cmb2_print_metabox_form
  • cmb2_update_option
  • cmb2_utils
  • date_create_from_format
  • date_timestamp_get
  • new_cmb2_box

Hooks

  • Hook Reference

Class CMB2_Type_File_Base

CMB File base field type

CMB2_Type_Base
Extended by CMB2_Type_Counter_Base
Extended by CMB2_Type_Text
Extended by CMB2_Type_File_Base

Direct known subclasses

CMB2_Type_File, CMB2_Type_File_List

Package: CMB2
Category: WordPress_Plugin
License: GPL-2.0+
Author: CMB2 team
Since: 2.2.2
Link: https://cmb2.io
Located at includes/types/CMB2_Type_File_Base.php

Methods summary

public boolean
# is_valid_img_ext( string $file, $blah = false )

Determines if a file has a valid image extension

Determines if a file has a valid image extension

Parameters

$file
File url
$blah

Returns

boolean
Whether file has a valid image extension

Since

1.0.0
public string
# img_status_output( array $args )

file/file_list image wrap

file/file_list image wrap

Parameters

$args
Array of arguments for output

Returns

string
Image wrap output

Since

2.0.2
public string
# file_status_output( array $args )

file/file_list file wrap

file/file_list file wrap

Parameters

$args
Array of arguments for output

Returns

string
File wrap output

Since

2.0.2
public static
# output_js_underscore_templates( )

Outputs the file/file_list underscore Javascript templates in the footer.

Outputs the file/file_list underscore Javascript templates in the footer.

Since

2.2.4
public static array
# get_image_size_data( array|string $img_size = '', string $fallback = 'thumbnail' )

Utility method to return an array of meta data for a registered image size

Utility method to return an array of meta data for a registered image size

Uses CMB2_Utils::get_named_size() to get the closest available named size from an array of width and height values and CMB2_Utils::get_available_image_sizes() to get the meta data associated with a named size.

Parameters

$img_size
Image size. Accepts an array of width and height (in that order)
$fallback
Size to use if the supplied named size doesn't exist

Returns

array

Array containing the image size meta data $size = ( 'width' => (int) image size width 'height' => (int) image size height 'name' => (string) e.g. 'thumbnail' )

Since

2.2.4
public static array
# prepare_image_sizes_for_js( array $response, integer|object $attachment, array $meta )

Filters attachment data prepared for JavaScript.

Filters attachment data prepared for JavaScript.

Adds the url, width, height, and orientation for custom sizes to the JavaScript object returned by the wp.media uploader. Hooked to 'wp_prepare_attachment_for_js'.

Parameters

$response
Array of prepared attachment data
$attachment
Attachment ID or object
$meta
Array of attachment meta data ( from wp_get_attachment_metadata() )

Returns

array
filtered $response array

Since

2.2.4

Methods inherited from CMB2_Type_Text

__construct(), render()

Methods inherited from CMB2_Type_Counter_Base

char_counter_markup(), enforce_max(), maybe_update_attributes_for_char_counter()

Methods inherited from CMB2_Type_Base

__call(), __get(), get_rendered(), parse_args(), parse_args_from_overrides(), rendered()

Properties summary

Properties inherited from CMB2_Type_Text

$type

Properties inherited from CMB2_Type_Counter_Base

$has_counter

Properties inherited from CMB2_Type_Base

$args, $rendered, $types

CMB2 Documentation API documentation generated by ApiGen