PHP code example of thecodeholic / yii2-grapesjs
1. Go to this page and download the library: Download thecodeholic/yii2-grapesjs library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thecodeholic / yii2-grapesjs example snippets
php yii migrate --migrationPath=@vendor/thecodeholic/yii2-grapesjs/migrations
'modules' => [
'grapesjs' => [
'class' => \thecodeholic\yii2grapesjs\Module::class,
// custom placeholder variables which will be added into richtext
// default is empty array
'grapesJsVariables' => [
'{first_name}' => 'First Name',
'{last_name}' => 'Last Name',
'{age}' => 'Age',
]
],
...
]
composer
'request' => [
'parsers' => [
'application/json' => 'yii\web\JsonParser',
]
]
echo \thecodeholic\yii2grapesjs\widgets\GrapesjsWidget::widget([
'clientOptions' => [
'storageManager' => [
'id' => '',
'type' => 'remote',
'stepsBeforeSave' => 1,
'urlStore' => "save?id=$model->id",
'urlLoad' => "get?id=$model->id",
],
'assetManager' => [
'upload' => "upload"
],
'deviceManager' => [
'defaultDevice' => 'Resolution 2',
'devices' => [
[
'name' => 'Resolution 1',
'width' => '850px',
'widthMedia' => '992px'
],
[
'name' => 'Resolution 2',
'width' => '750px',
],
[
'name' => 'Resolution 3',
'width' => '650px'
],
[
'name' => 'Resolution 4',
'width' => '450px',
],
[
'name' => 'Resolution 5',
'width' => '375px',
]
]
]
],
// custom placeholder variables which will be added into richtext
// default is empty array
'variables' => [
'{first_name}' => 'First Name',
'{last_name}' => 'Last Name',
'{age}' => 'Age',
]
])
public function actions()
{
return array_merge(parent::actions(), [
'get' => [
'class' => \thecodeholic\yii2grapesjs\actions\GetAction::class,
// If 'save' => \thecodeholic\yii2grapesjs\actions\SaveAction::class,
'upload' => \thecodeholic\yii2grapesjs\actions\UploadAction::class
]);
}
php composer.phar