Since v0.5
This class is extended of CardWidget therefore it has the same properties but it has its own properties listed below.
excluding CardWidget properties
string $chatColor = 'primary'
- chat messages color (Bootstrap 4 colors or additional colors of AdminLTE)string $author = ''
- author's name, this property is used to highlight author's messages with $chatColorarray $messages = []
- array of messagesarray $contacts = []
- contacts list. if it is empty there will be no chat icon in the header of the chatstring $noMessages = 'There is no messages in the chat'
- the message which will be shown if $messages is emptystring $sendFormUrl = ''
- URL to send a new messagestring $sendFormButtonTitle = 'Send'
- title of send buttonstring $sendFormPlaceholder = 'Type Message ...'
- placeholder for send form
<?php DirectChatWidget::begin([
'title' => 'Admin direct chat',
'color' => 'info',
'chatColor' => 'info',
'close' => true,
'author' => 'Admin',
'sendFormPlaceholder' => 'Type your message here ...',
'sendFormButtonTitle' => '<i class="fas fa-paper-plane"></i>',
'tools' => [
CardToolsHelper::label('3', [
'class' => 'badge badge-dark',
'title' => '3 new messages',
]),
// OR you can use classic array
/*[
'label',
'3',
[
'class' => 'badge badge-dark',
'title' => '3 new messages',
],
],*/
],
'messages' => [
[
'Admin',
'23 Jan 2:00 pm',
'../assets/img/user1-128x128.jpg',
'Is this template really for free? That\'s unbelievable!',
],
[
'Sarah Bullock',
'23 Jan 2:04 pm',
'../assets/img/user5-128x128.jpg',
'You better believe it!',
],
[
'Admin',
'23 Jan 5:07 pm',
'../assets/img/user1-128x128.jpg',
'Working with AdminLTE on a great new app! Wanna join?',
],
[
'Sarah Bullock',
'23 Jan 6:10 pm',
'../assets/img/user5-128x128.jpg',
'I would love to.',
],
[
'Admin',
'25 Jan 1:00 pm',
'../assets/img/user1-128x128.jpg',
'test message!',
],
],
'contacts' => [
[
'Admin',
'1/28/2022',
'../assets/img/user1-128x128.jpg',
'How have you been? I was...',
'#',
],
[
'Sarah Bullock',
'1/28/2022',
'../assets/img/user5-128x128.jpg',
'I will be waiting for...',
'#link_to_profile',
],
],
]); ?>
<!-- you can manually put HTML messages here* -->
<!-- you can manually put HTML contacts here* -->
<?php DirectChatWidget::end(); ?>
* - leave empty $messages and/or $contacts properties and see AdminLTE documentation for examples.