'',
'attributes' => [],
'std' => '',
'desc' => '',
];
$field = array_merge( $defaults, $field );
$method_name = $field['type'];
if ( ! method_exists( __CLASS__, $method_name ) ) {
$method_name = 'text';
}
self::$method_name( $field );
}
/**
* Render text control.
*
* Generates the final HTML for text controls.
*
* @since 2.0.0
* @access private
* @static
*
* @param array $field Field data.
*/
private static function text( array $field ) {
if ( empty( $field['attributes']['class'] ) ) {
$field['attributes']['class'] = 'regular-text';
}
?>
/>
$option_value ) :
?>
[],
];
$field = array_merge( $defaults, $field );
$post_types_objects = get_post_types(
[
'public' => true,
], 'objects'
);
/**
* Filters the list of post type objects used by Elementor.
*
* @since 2.8.0
*
* @param array $post_types_objects List of post type objects used by Elementor.
*/
$post_types_objects = apply_filters( 'elementor/settings/controls/checkbox_list_cpt/post_type_objects', $post_types_objects );
$field['options'] = [];
foreach ( $post_types_objects as $cpt_slug => $post_type ) {
if ( in_array( $cpt_slug, $field['exclude'], true ) ) {
continue;
}
$field['options'][ $cpt_slug ] = $post_type->labels->name;
}
self::checkbox_list( $field );
}
/**
* Render checkbox list control for user roles.
*
* Generates the final HTML for checkbox list controls populated with user roles.
*
* @since 2.0.0
* @access private
* @static
*
* @param array $field Field data.
*/
private static function checkbox_list_roles( array $field ) {
$defaults = [
'exclude' => [],
];
$field = array_merge( $defaults, $field );
$field['options'] = [];
$roles = get_editable_roles();
if ( is_multisite() ) {
$roles = [
'super_admin' => [
'name' => esc_html__( 'Super Admin', 'elementor' ),
],
] + $roles;
}
foreach ( $roles as $role_slug => $role_data ) {
if ( in_array( $role_slug, $field['exclude'] ) ) {
continue;
}
$field['options'][ $role_slug ] = $role_data['name'];
}
self::checkbox_list( $field );
}
/**
* Render raw HTML control.
*
* Generates the final HTML for raw HTML controls.
*
* @since 2.0.0
* @access private
* @static
*
* @param array $field Field data.
*/
private static function raw_html( array $field ) {
if ( empty( $field['html'] ) ) {
return;
}
?>