I have 3 arrays in a function which I want to return as it is seperated by comma. Tried array_merge
, array_combine
, array_merge_recursive
as well as the +
operator, but nothing worked.
Here is the function I have:
function svca_icon_fields() {
$icon = array (
'type' => 'dropdown',
'heading' => __( 'Select Icon Type', 'svca-addon' ),
'param_name' => 'icon_type',
'description' => __( 'Select Icon Type', 'svca-addon' ),
'value' => array(
__( 'No Icon', 'svca-addon' ) => 'noicon',
__( 'Font Awesome', 'svca-addon' ) => 'fontawesome',
__( 'Open Iconic', 'svca-addon' ) => 'openiconic',
__( 'Typicons', 'svca-addon' ) => 'typicons',
__( 'Entypo', 'svca-addon' ) => 'entypo',
__( 'Linecons', 'svca-addon' ) => 'linecons',
),
);
$fa = array(
'type' => 'iconpicker',
'value' => 'fa fa-star',
'heading' => __( 'Icon', 'svca-addon' ),
'param_name' => 'fa_icon',
'description' => __( 'Pick an Icon to represent your package.', 'svca-addon' ),
'settings' => array(
'emptyIcon' => false,
'type' => 'fontawesome',
'iconsPerPage' => 200,
),
'dependency' => array( 'element' => 'icon_type', 'value' => 'fontawesome' ),
);
$oi = array(
'type' => 'iconpicker',
'value' => 'vc-oi vc-oi-eye',
'heading' => __( 'Icon', 'svca-addon' ),
'param_name' => 'oi_icon',
'description' => __( 'Pick an Icon to represent your package.', 'svca-addon' ),
'settings' => array(
'emptyIcon' => false,
'type' => 'openiconic',
'iconsPerPage' => 200,
),
'dependency' => array( 'element' => 'icon_type', 'value' => 'openiconic' ),
);
$data = array_merge_recursive( $icon, $fa, $oi );
//$data = array_merge( $icon, $fa, $oi );
//$data = array_combine( $icon, $fa, $oi );
//$data = $icon + $fa + $oi + $ti + $et + $li;
//$data = $icon . $fa . $oi . $ti . $et . $li;
//return $data;
echo '<pre>';
print_r( $data );
echo '</pre>';
}
And, here is what I want to return:
array (
'type' => 'dropdown',
'heading' => __( 'Select Icon Type', 'svca-addon' ),
'param_name' => 'icon_type',
'description' => __( 'Select Icon Type', 'svca-addon' ),
'value' => array(
__( 'No Icon', 'svca-addon' ) => 'noicon',
__( 'Font Awesome', 'svca-addon' ) => 'fontawesome',
__( 'Open Iconic', 'svca-addon' ) => 'openiconic',
__( 'Typicons', 'svca-addon' ) => 'typicons',
__( 'Entypo', 'svca-addon' ) => 'entypo',
__( 'Linecons', 'svca-addon' ) => 'linecons',
),
), //Seperated By Comma
array(
'type' => 'iconpicker',
'value' => 'fa fa-star',
'heading' => __( 'Icon', 'svca-addon' ),
'param_name' => 'fa_icon',
'description' => __( 'Pick an Icon to represent your package.', 'svca-addon' ),
'settings' => array(
'emptyIcon' => false,
'type' => 'fontawesome',
'iconsPerPage' => 200,
),
'dependency' => array( 'element' => 'icon_type', 'value' => 'fontawesome' ),
), //Seperated By Comma
array(
'type' => 'iconpicker',
'value' => 'vc-oi vc-oi-eye',
'heading' => __( 'Icon', 'svca-addon' ),
'param_name' => 'oi_icon',
'description' => __( 'Pick an Icon to represent your package.', 'svca-addon' ),
'settings' => array(
'emptyIcon' => false,
'type' => 'openiconic',
'iconsPerPage' => 200,
),
'dependency' => array( 'element' => 'icon_type', 'value' => 'openiconic' ),
), //Seperated By Comma
Spent like last 2 hours figuring this out without success.
Thanks