Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
PUM_Fields::objectselect_callback( array $args, null $value = null )
Object Select Callback
Description Description
Renders select fields.
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Parameters Parameters
- $args
-
(Required) Arguments passed by the setting
- $value
-
(Optional)
Default value: null
Source Source
File: includes/class-pum-fields.php
public function objectselect_callback( $args, $value = null ) { if ( $args['type'] != 'objectselect' ) { $args['class'] .= ' pum-field-objectselect'; } $args['class'] .= ' pum-field-select pum-field-select2'; if ( ! $value ) { $value = isset( $args['std'] ) ? $args['std'] : ''; } $multiple = null; if ( $args['multiple'] ) { $multiple = 'multiple'; $args['class'] .= ' pum-field-select--multiple'; $args['name'] .= $args['as_array'] ? '[]' : ''; $value = ! is_array( $value ) ? array( $value ) : $value; $value = wp_parse_id_list( $value ); } $this->field_before( $args ); $this->field_label( $args ); ?> <select id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $args['name'] ); ?>" data-placeholder="<?php echo esc_attr( $args['placeholder'] ); ?>" data-allow-clear="true" <?php echo $multiple; ?> data-objecttype="<?php echo esc_attr( $args['object_type'] ); ?>" data-objectkey="<?php echo esc_attr( $args['object_key'] ); ?>" data-current="<?php echo maybe_json_attr( $value, true ); ?>" <?php if ( $args['required'] ) { echo 'required'; } ?>> <?php if ( ! empty( $args['options'] ) ) { foreach ( $args['options'] as $label => $option ) { $selected = ( $multiple && in_array( $option, $value ) ) || ( ! $multiple && $option == $value ); ?> <option value="<?php echo esc_attr( $option ); ?>" <?php selected( 1, $selected ); ?>><?php echo esc_html( $label ); ?></option><?php } } ?> </select><?php $this->field_description( $args ); $this->field_after(); }
Expand full source code Collapse full source code View on Trac