The options of a select field needs to be shown in a list on the profile page shown for public.
Now it shows in a row seperated by a komma.
How to change
$options = (array) json_decode( $data[ 'select_alias_field' ] );
if ( is_array( $options ) && count( $options ) ) {
$content = '<ul>';
foreach( $options as $option ) {
$content .= '<li>' . $option . '</li>';
}
$content .= '</ul>';
$data[ 'textarea_field_alias' ] = $content;
}
else $data[ 'textarea_field_alias' ] = '';
$texts = array(
'value1' => 'text1',
'value2' => 'text2',
'value3' => 'text3',
);
$content .= '<li>' . $text[ $option ] . '</li>';
$texts = array(
'value1' => 'text1',
'value2' => 'text2',
'value3' => 'text3'
);
$options = (array) json_decode( $data[ 'select_alias_field' ] );
if ( is_array( $options ) && count( $options ) ) {
$content = '<ul>';
foreach( $options as $option ) {
if( isset( $text[ $option ] ) ) $content .= '<li>' . $text[ $option ] . '</li>';
}
$content .= '</ul>';
$data[ 'textarea_field_alias' ] = $content;
}
else $data[ 'textarea_field_alias' ] = '';
if( isset( $text[ $option ] ) ) $content .= '<li>' . $text[ $option ] . '</li>';
if( isset( $texts[ $option ] ) ) $content .= '<li>' . $texts[ $option ] . '</li>';
$texts = array(
'value_for_option1' => 'Regisseur',
'value_for_option2' => 'Technicus',
......
);
$texts = array(
'music' => 'Music',
'art' => 'art'
)
only thing.. when there will be an option added, i need to change the skeleton.php either..Yes, you should add the new option in the skeleton.php file, there is also another way to make it dynamically but it is too complex.
class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user,&$data,$changed,$isNew)
{
$texts = array(
'0' => 'Acteur',
'1' => 'Voice-over',
'2' => 'Vertaler',
'3' => 'Regisseur',
'4' => 'Technicus'
);
$options = (array) json_decode( $data[ 'test3' ] );
if ( is_array( $options ) && count( $options ) ) {
$content = '<ul>';
foreach( $options as $option ) {
if( isset( $texts[ $option ] ) ) $content .= '<li>' . $texts[ $option ] . '</li>';
}
$content .= '</ul>';
$data[ 'test3_text' ] = $content;
}
else $data[ 'test3_text' ] = '';
}
}