File "Testimonial.php"
Full Path: /home/bettaeza/flyinsyria.com/Template/Blocks/Testimonial.php
File size: 2.24 KB
MIME-type: text/x-php
Charset: utf-8
<?php
namespace Modules\Template\Blocks;
use Modules\Media\Helpers\FileHelper;
class Testimonial extends BaseBlock
{
public function getOptions(){
return [
'settings' => [
[
'id' => 'title',
'type' => 'input',
'inputType' => 'text',
'label' => __('Title')
],
[
'id' => 'list_item',
'type' => 'listItem',
'label' => __('List Item(s)'),
'title_field' => 'title',
'settings' => [
[
'id' => 'name',
'type' => 'input',
'inputType' => 'text',
'label' => __('Name')
],
[
'id' => 'desc',
'type' => 'textArea',
'label' => __('Desc')
],
[
'id' => 'number_star',
'type' => 'input',
'inputType' => 'number',
'label' => __('Number star')
],
[
'id' => 'avatar',
'type' => 'uploader',
'label' => __('Avatar Image')
],
]
],
],
'category'=>__("Other Block")
];
}
public function getName()
{
return __('List Testimonial');
}
public function content($model = [])
{
return view('Template::frontend.blocks.testimonial.index', $model);
}
public function contentAPI($model = []){
if(!empty($model['list_item'])){
foreach ( $model['list_item'] as &$item ){
$item['avatar_url'] = FileHelper::url($item['avatar'], 'full');
}
}
return $model;
}
}