'action.operations', ACTION_RECOVERY_OPERATION => 'action.recovery.operations', ACTION_UPDATE_OPERATION => 'action.update.operations' ]; $output = [ 'body' => (new CPartial($partials[$data['recovery']], $data))->getOutput() ]; $output['messages'] = []; $messages = CMessageHelper::getMessages(); if (count($messages) !== 0) { $output['messages'] = [$messages[0]['message']]; } echo json_encode($output);