$field ) {
if ( 'repeater' === $field['type'] ) {
return true;
}
}
return false;
}
/**
* Generate fields.
*
* @param object $self Widget object.
* @param array $fields Fields array.
* @param string $repeater_id Repeater ID.
* @return void
*/
function generate( $self, $fields = array(), $repeater_id = '' ) {
$defaults = array(
'type' => '',
'id' => '',
'name' => '',
'default' => '',
'desc' => '',
);
if ( ! empty( $fields ) && is_array( $fields ) ) {
foreach ( $fields as $key => $value ) {
$value = wp_parse_args( $value, $defaults );
$class = isset( $value['class'] ) ? $value['class'] : '';
switch ( $value['type'] ) {
case 'icon':
$field_id = '';
$field_name = '';
if ( empty( $repeater_id ) || $this->have_repeator_field( $fields ) ) {
$field_id = $self->get_field_id( $value['id'] );
$field_name = $self->get_field_name( $value['id'] );
}
?>
id="get_field_id( $value['id'] ) ); ?>"
name="get_field_name( $value['id'] ) ); ?>" />
generate_repeater_fields( $self, $fields, $value );
?>
id_base . '[' . $self->number . '][' . $value['id'] . ']';
?>
generate( $self, $value['options'], $value['id'] ); ?>
have_repeator_field( $fields ) ) {
$field_id = $self->get_field_id( $value['id'] );
$field_name = $self->get_field_name( $value['id'] );
}
?>
have_repeator_field( $fields ) ) {
$field_id = $self->get_field_id( $value['id'] );
$field_name = $self->get_field_name( $value['id'] );
}
?>
Remove
Choose Media
class="widefat" type="radio" name="get_field_name( $value['id'] ); ?>" value="" />
have_repeator_field( $fields ) ) {
$field_id = $self->get_field_id( $value['id'] );
$field_name = $self->get_field_name( $value['id'] );
}
?>
array(
'color' => '#db4437',
),
'astra-icon-google' => array(
'color' => '#',
),
'astra-icon-twitter' => array(
'color' => '#1da1f2',
),
'astra-icon-facebook' => array(
'color' => '#3b5998',
),
'astra-icon-facebook-f' => array(
'color' => '#3b5998',
),
'astra-icon-check-circle' => array(
'color' => '#',
),
'astra-icon-shopping-cart' => array(
'color' => '#',
),
'astra-icon-shopping-bag' => array(
'color' => '#',
),
'astra-icon-shopping-basket' => array(
'color' => '#',
),
'astra-icon-circle-o' => array(
'color' => '#',
),
'astra-icon-certificate' => array(
'color' => '#',
),
'astra-icon-envelope' => array(
'color' => '#',
),
'astra-icon-file' => array(
'color' => '#',
),
'astra-icon-phone' => array(
'color' => '#',
),
'astra-icon-globe' => array(
'color' => '#',
),
'astra-icon-down_arrow' => array(
'color' => '#',
),
'astra-icon-close' => array(
'color' => '#',
),
'astra-icon-drag_handle' => array(
'color' => '#',
),
'astra-icon-format_align_justify' => array(
'color' => '#',
),
'astra-icon-menu' => array(
'color' => '#',
),
'astra-icon-reorder' => array(
'color' => '#',
),
'astra-icon-search' => array(
'color' => '#',
),
'astra-icon-zoom_in' => array(
'color' => '#',
),
);
return $icons;
}
/**
* Generate repeatable fields.
*
* @param object $self Widget object.
* @param array $fields Fields array.
* @param array $value Default value.
* @return void
*/
function generate_repeater_fields( $self, $fields, $value ) {
$instances = $self->get_settings();
if ( array_key_exists( $self->number, $instances ) ) {
$instance = $instances[ $self->number ];
if ( array_key_exists( $value['id'], $instance ) ) {
$stored = $instance[ $value['id'] ];
$repeater_options = $value['options'];
$repeater_fields = array();
foreach ( $repeater_options as $index => $field ) {
foreach ( $stored as $stored_index => $stored_field ) {
foreach ( $stored_field as $stored_field_id => $stored_field_value ) {
if ( $stored_field_id === $field['id'] ) {
$field['default'] = $stored_field_value;
$repeater_fields[ $stored_index ][] = $field;
}
}
}
}
// Generate field.
foreach ( $repeater_fields as $index => $fields ) {
?>
generate( $self, $fields, $value['id'] ); ?>
generate( $self, $fields, $repeater_id );
}
endif;