1. Go to this page and download the library: Download bupy7/yii2-bbcode 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/ */
bupy7 / yii2-bbcode example snippets
echo $form->field($model, 'content')->textArea();
use bupy7\bbcode\BBCodeBehavior;
public function behaviors()
{
return [
...
[
'class' => BBCodeBehavior::className(),
'attribute' => 'content',
'saveAttribute' => 'purified_content',
],
...
];
}
public function behaviors()
{
return [
...
[
'class' => BBCodeBehavior::className(),
'attribute' => 'content',
'saveAttribute' => 'purified_content',
'codeDefinitionBuilder' => [
// as elements of array
['quote', '<blockquote>{param}</blockquote>'],
// as class name where class is instance of extended class \JBBCode\CodeDefinitionBuilder
'/namespace/to/CodeDefinitionBuilder/ExtendedClassName',
// as extended instance of extended class \JBBCode\CodeDefinitionBuilder
$className,
// as callable function where $builder is instance of class \JBBCode\CodeDefinitionBuilder
function($builder) {
$builder->setTagName('code');
$builder->setReplacementText('<pre>{param}</pre>');
return $builder->build();
},
],
]
...
];
}
public function behaviors()
{
return [
...
[
'class' => BBCodeBehavior::className(),
'attribute' => 'content',
'saveAttribute' => 'purified_content',
'codeDefinitionSet' => [
// as class name where class is instance of extended class \JBBCode\CodeDefinitionSet
'/namespace/to/CodeDefinitionSet/ExtendedClassName',
// as extended instance of extended class \JBBCode\CodeDefinitionSet
$className,
],
],
...
];
}
public function behaviors()
{
return [
...
[
'class' => BBCodeBehavior::className(),
'attribute' => 'content',
'saveAttribute' => 'purified_content',
'codeDefinition' => [
// as class name where class is instance of extended class \JBBCode\CodeDefinition
'/namespace/to/CodeDefinition/ExtendedClassName',
// as extended instance of extended class \JBBCode\CodeDefinition
$className,
],
],
...
];
}
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.