D
D
Dmitry Sidorenko2015-03-28 13:59:32
Yii
Dmitry Sidorenko, 2015-03-28 13:59:32

Why does Class 'HTMLPurifier_Config' not found error occur?

Yii2
Error occurs - Class 'HTMLPurifier_Config' not found
Due to asHTML modifier - 'format' => ['html'],
Here is the template where the error occurs
<?=GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'class' => DataColumn::className(),
'attribute' => 'name',
'label' => 'Role '
],
[
'class' => DataColumn::className(),
'label' => 'Permissions',
'format' => ['html'], // An error occurs due to the HTML format
'value' => function($data) { return implode('
',array_keys(ArrayHelper::map(Yii::$app->authManager->getPermissionsByRole($data->name), 'description', 'description' )));}
],
----
In the Yii2 framework there is a BaseHtmlPurifier.php file
, it has a
public static function process($content, $config = null)
method in the method called -
$configInstance = \HTMLPurifier_Config::create($ config instanceof \Closure ?null : $config);
and physically this class I have nowhere.
How many rabbit legs does it take to make this work?)
Why doesn't it work out of the box? Perhaps he doesn’t understand what doctype to display, but why didn’t they make HTML5 by default?)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Makarov, 2015-03-31
@sidorenkoda

Did you do a composer install?

V
Vyacheslav Spasskiy, 2018-12-11
@CJIABKO

In the login file (@app/web/index.php) add before

require dirname(__DIR__) . '/vendor/yiisoft/yii2/Yii.php';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question