How to change the value in array with if/else?
CODE:
public function getActions()
{
return array(
'dislike' => array(
'enabled' => true,
'action_type_id' => 2,
'phrase' => Phpfox::getPhrase('like.dislike'),
'phrase_in_past_tense' => 'disliked',
'item_phrase' => 'comment',
'item_type_id' => 'feed',
'table' => 'feed_comment',
'column_update' => 'total_dislike',
'column_find' => 'feed_comment_id',
'where_to_show' => array('', 'photo')
)
);
}
How to insert code for change with if/else?
if (Phpfox::isMobile())
{
'phrase' => Phpfox::getPhrase('mobiletemplate.unlike_icon'),
}
else
{
'phrase' => Phpfox::getPhrase('like.dislike'),
}
Thank you for help me!
You can solve this logical problem with the use of the ternary operator:
'phrase' => Phpfox::isMobile() ? Phpfox::getPhrase('mobiletemplate.unlike_icon') : Phpfox::getPhrase('like.dislike'),