HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/apklausos/tests/data/plugins/NewQuestionAttributesPlugin.php
<?php

class NewQuestionAttributesPlugin extends PluginBase
{
    protected static $description = 'Dummy plugin for testing newQuestionAttributes event';
    protected static $name = 'NewQuestionAttributesPlugin';

    public function init()
    {
        $this->subscribe('newQuestionAttributes');
    }

    public function newQuestionAttributes()
    {
        $event = $this->getEvent();
        $questionAttributes = [
            'testAttribute' => [
                'types'     => 'S',
                'category'  => 'Test',
                'sortorder' => 1,
                'inputtype' => 'text',
                'default'   => '',
                'caption'   => 'Test Attribute',
                'help'      => 'This is a dummy attribute for testing purposes.',
                'expression'=> 1,
            ],
            'testAttributeForArray' => [
                'types'     => 'F',
                'category'  => gT('Test'),
                'sortorder' => 1,
                'inputtype' => 'text',
                'default'   => '',
                'caption'   => 'Test Attribute for Array type',
                'help'      => 'This is a dummy attribute for testing purposes.',
                'expression'=> 1,
            ],
            'nonFilteredAttribute' => [
                'types'     => 'S',
                'category'  => 'Test',
                'sortorder' => 1,
                'inputtype' => 'text',
                'default'   => '',
                'caption'   => 'Non Filtered Test Attribute',
                'help'      => 'This is a dummy attribute for testing purposes. It\'s not filtered for XSS',
                'xssfilter' => false,
                'expression'=> 1,
            ],
        ];
        $event->append('questionAttributes', $questionAttributes);
    }
}