Мне нужно построить многомерный массив с помощью foreach. Существует массив с именами социальных сетей social_array()
результат должен быть таким:
array(
'type' => 'textfield',
'heading' => 'social_label1',
'param_name' => 'social_name1',
'description' => '',
'edit_field_class' => 'vc_col-sm-4 vc_column-with-padding',
'group' => __('Social', 'AS')
),
array(
'type' => 'textfield',
'heading' => 'social_label2',
'param_name' => 'social_name2',
'description' => '',
'edit_field_class' => 'vc_col-sm-4 vc_column-with-padding',
'group' => __('Social', 'AS')
),
...
etc
Проблема в том, что мой код дает мне только один результат, последний
foreach ( social_array() as $icon => $value ) :
$k = array('type', 'heading', 'param_name', 'description', 'edit_field_class', 'group');
$v = array('textfield', $value['label'], $icon, '', 'vc_col-sm-4 vc_column-with-padding', 'Social');
$c = array_combine($k, $v);
$attributes['params'] = $c;
endforeach;
vc_add_params( 'profile_card', $attributes ); // Note: base for element
Социальный при необходимости
function social_array(){
return array(
'facebook' => array('label' => __('Facebook','AS7'), 'type' => 'text' ),
'behance' => array('label' => __('Behance','AS7'), 'type' => 'text' ),
'weibo' => array('label' => __('Weibo','AS7'), 'type' => 'text' ),
'renren' => array('label' => __('Renren','AS7'), 'type' => 'text' ),
'dropbox' => array('label' => __('Dropbox','AS7'), 'type' => 'text' ),
'bitbucket' => array('label' => __('Bitbucket','AS7'), 'type' => 'text' ),
'trello' => array('label' => __('Trello','AS7'), 'type' => 'text' ),
'odnoklassniki' => array('label' => __('Odnoklassniki','AS7'), 'type' => 'text' ),
'vk' => array('label' => __('VKontakte','AS7'), 'type' => 'text' ),
);
}