PHP code example of coderius / yii2-pell-widget
1. Go to this page and download the library: Download coderius/yii2-pell-widget 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/ */
coderius / yii2-pell-widget example snippets
echo Pell::widget([
'model' => $model,
'attribute' => 'text',
]);
$value = 'textarea some content';
echo \coderius\pell\Pell::widget([
'name' => 'textarea-name',
'value' => $value,
'clientOptions' =>[]
]);
echo Pell::widget([
'asFormPart' => false,
'value' => $value,
'clientOptions' =>[
'onChange' => new JsExpression(
"html => {
console.log(html);
},"
)
]
]);
use coderius\pell\Pell;
<?= $form->field($model, 'text')->widget(Pell::className(), []);
// Having the following scenario
<script>
function jsFunctionToBeCalled() {
// ...
}
</script>
<?= $form->field($model, 'content')->widget(Pell::className(), [
'clientOptions' => [
'defaultParagraphSeparato' => 'div',
// ...
'actions' => [
'bold',
'italic',
'underline',
'strikethrough',
'heading1',
'heading2',
'paragraph',
'quote',
'olist',
'ulist',
'code',
'line',
'link',
'image',
[
'name' => 'backColor',
'icon' => '<div style="background-color:pink;">A</div>',
'title' => 'Highlight Color',
// this will render the function name without quotes on the configuration options of the plugin
'result' => new JsExpression('jsFunctionToBeCalled')
],
],
// ...
]
]
]);