Called from Flexform to provide menu items with Neuerwerbungen subjects.

@param array $config
@return array
775309
public function buildMenu($config)
    {
        $rootNodes = $this->queryForChildrenOf('NE');

        $options = [['', '']];
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($rootNodes)) {
            $optionTitle = $row['descr'];
            $optionValue = $row['ppn'];
            $options[] = [$optionTitle , $optionValue];
        }

        $config['items'] = array_merge($config['items'], $options);
        return $config;
    }
1126943
protected function buildForm(array $config)
    {
        return isset($config['form'])
            ? $config['form']
            : ClassUtils::getClass($this->filterFormRegistry[$this->buildType($config)]);
    }
546247
public static function config($config = []) {
		if (!$config) {
			return ['classes' => static::$_classes, 'unicode' => static::$_unicode];
		}
		if (isset($config['classes'])) {
			static::$_classes = $config['classes'] + static::$_classes;
		}
		if (isset($config['unicode'])) {
			static::$_unicode = $config['unicode'];
		}
	}
737115
public static function getFeaturePolicyHeader(array $config): array
    {
        $directives = [
            'accelerometer',
            'ambient-light-sensor',
            'autoplay',
            'camera',
            'encrypted-media',
            'fullscreen',
            'geolocation',
            'gyroscope',
            'magnetometer',
            'microphone',
            'midi',
            'payment',
            'picture-in-picture',
            'speaker',
            'sync-xhr',
            'usb',
            'var',
        ];

        foreach ($directives as $directive) {
            if (! isset($config[$directive]) || empty($config[$directive])) {
                continue;
            }

            $value = '';

            if ($config[$directive]['none']) {
                $value = "'none'";
            } elseif ($config[$directive]['*']) {
                $value = '*';
            } else {
                if ($config[$directive]['self']) {
                    $value = "'self'";
                }

                foreach ($config[$directive]['allow'] as $url) {
                    if (false !== ($url = filter_var($url, FILTER_SANITIZE_URL))) {
                        $value = sprintf('%s %s', $value, $url);
                    }
                }
            }

            if (strlen($value = trim($value)) > 0) {
                $headers[] = sprintf('%s %s', $directive, $value);
            }
        }

        if (! isset($headers)) {
            return [];
        }

        return ['Feature-Policy' => implode('; ', $headers)];
    }
1179864
protected function getCommands(array $config)
    {
        if (!is_array($config['plugins'])) {
            throw new \RuntimeException(
                'Configuration "plugins" key must reference an array',
                self::ERR_PLUGINS_NONARRAY
            );
        }

        $plugins = array_filter(
            $config['plugins'],
            function($plugin) {
                return $plugin instanceof PluginInterface;
            }
        );
        if (count($plugins) != count($config['plugins'])) {
            throw new \RuntimeException(
                'All configuration "plugins" array values must implement \Phergie\Irc\Bot\React\PluginInterface',
                self::ERR_PLUGINS_NONPLUGINS
            );
        }

        $commands = array();
        foreach ($plugins as $plugin) {
            $events = array_keys($plugin->getSubscribedEvents());
            $commandEvents = array();
            foreach ($events as $event) {
                if (!preg_match('/^command\.(.+)\.help$/', $event, $match)) {
                    continue;
                }
                $commands[$match[1]] = true;
            }
        }

        return $this->alphabetize($commands);
    }
1155939
protected function prepareConfig(array $config)
    {
        $config = new Config($config);
        $config->setFallback($this->getConfig());

        return $config;
    }
435615
private function getCurrentMailer(array $config)
    {
        if ($this->mailer !== null) {
            return $this->mailer;
        }

        if ($config['mailer'] == 'smtp') {
            $transport = \Swift_SmtpTransport::newInstance(
                $config['smtpHost'],
                $config['smtpPort'],
                $config['smtpSecurity']
            );
            $transport->setUsername($config['smtpUsername']);
            $transport->setPassword($config['smtpPassword']);
        } elseif ($config['mailer'] == 'mail') {
            $transport = \Swift_MailTransport::newInstance();
        } else {
            $transport = \Swift_SendmailTransport::newInstance();
        }

        return \Swift_Mailer::newInstance($transport);
    }
1189859
protected function getModuleIds(array $config): array
    {
        $moduleIds = array_filter(
            array_map(
                function ($item) {
                    return $item['module'];
                },
                array_filter(
                    $config,
                    function ($item) {
                        return $item['inactive'] == '';
                    }
                )
            ),
            'is_numeric'
        );

        return $moduleIds;
    }
230369
public function getParameters(array $config)
    {
        $params = [
            'opifer_content.content_class' => $config['content']['class'],
            'opifer_content.content_index_view' => $config['content']['views']['index'],
            'opifer_content.content_type_view' => $config['content']['views']['type'],
            'opifer_content.content_edit_type' => $config['content']['views']['edit_type'],
            'opifer_content.content_select_type' => $config['content']['views']['select_type'],
            'opifer_content.content_select_site' => $config['content']['views']['select_site'],
            'opifer_content.content_select_layout_type' => $config['content']['views']['select_layout_type'],
            'opifer_content.content_new_view' => $config['content']['views']['new'],
            'opifer_content.content_design_view' => $config['content']['views']['design'],
            'opifer_content.content_edit_view' => $config['content']['views']['edit'],
            'opifer_content.content_details_view' => $config['content']['views']['details'],
            'opifer_content.content_history_view' => $config['content']['views']['history'],
            'opifer_content.content_type_class' => $config['content_type']['class'],
            'opifer_content.content_type_index_view' => $config['content_type']['views']['index'],
            'opifer_content.content_type_create_view' => $config['content_type']['views']['create'],
            'opifer_content.content_type_edit_view' => $config['content_type']['views']['edit'],
        ];

        // Block configuration
        foreach ($config['blocks'] as $block => $blockConfig) {
            $params['opifer_content.'.$block.'_block_configuration'] = $blockConfig;
        }

        return $params;
    }
1018426
protected function getReadConfig(array $config)
    {
        $readConfig = $this->getReadWriteConfig($config, 'read');

        return $this->mergeReadWriteConfig($config, $readConfig);
    }
361157
protected function createDataColumnByConfig(array $config = [])
    {
        return Yii::createObject(array_merge([
            'class' => $this->dataColumnClass ?: \yii\grid\DataColumn::class,
            'grid'  => $this,
        ], $config));
    }
574490
protected function addGeneratedNonce(array $config): array
    {
        if (($config['csp']['script-src']['add-generated-nonce'] ?? false) === true) {
            $config['csp']['script-src']['nonces'][] = self::nonce();
        }

        if (($config['csp']['style-src']['add-generated-nonce'] ?? false) === true) {
            $config['csp']['style-src']['nonces'][] = self::nonce();
        }

        return $config;
    }
134744
private static function preformPlaceHolder(array $config): array
    {
        $preform = [];

        foreach ($config as $name => $value) {
            if (Assert::array($value)) {
                $preform[$name] = static::preformPlaceHolder($value);
            } elseif (Assert::string($value)) {
                $preform[$name] = trim($value);

                foreach (static::$placeholders as $placeholder => $path) {
                    if (Assert::contains($preform[$name], $placeholder)) {
                        $preform[$name] = str_replace($placeholder, $path, $preform[$name]);
                    }
                }
            } else {
                $preform[$name] = trim($value);
            }
        }

        return $preform;
    }
809528
public function initialize(array $config)
    {
        $this->belongsToMany('Roles', [
            'className' => 'User.Roles',
            'joinTable' => 'users_roles',
            'through' => 'UsersRoles',
            'propertyName' => 'roles',
        ]);
        $this->addBehavior('Timestamp', [
            'events' => [
                'Model.beforeSave' => [
                    'created' => 'new',
                ],
                'Users.login' => [
                    'last_login' => 'always'
                ]
            ]
        ]);
        $this->addBehavior('Search.Searchable', [
            'fields' => function ($user) {
                $words = '';
                $words .= empty($user->name) ?: " {$user->name}";
                $words .= empty($user->username) ?: " {$user->username}";
                $words .= empty($user->email) ?: " {$user->email}";
                $words .= empty($user->web) ?: " {$user->web}";

                if (!empty($user->_fields)) {
                    foreach ($user->_fields as $vf) {
                        $words .= ' ' . trim($vf->value);
                    }
                }

                return $words;
            }
        ]);
        $this->addBehavior('Field.Fieldable');

        $this->addSearchOperator('created', 'Search.Date', ['field' => 'created']);
        $this->addSearchOperator('limit', 'Search.Limit');
        $this->addSearchOperator('email', 'Search.Generic', ['field' => 'email', 'conjunction' => 'auto']);
        $this->addSearchOperator('order', 'Search.Order', ['fields' => ['name', 'username', 'email', 'web']]);
    }
732005
public function listAll(array $config = [])
    {
        try {
            return $this->privateList($config);
        } catch (\Exception $e) {
            if ($e instanceof RequestException) {
                /*
                 * ListReleased and List return 404 error if no results are found, even for successful API calls,
                 * So if result status is 404, transform to 200 with empty results.
                 */
                /** @var ResponseInterface $response */
                $response = $e->getResponse();
                if (strval($response->getStatusCode()) === '404') {
                    return [
                        'statusCode' => 200,
                        'list' => [
                            'meta' => [
                                'totalCount' => 0
                            ]
                        ],
                        'elements' => []
                    ];
                }
                throw $e;
            } else {
                throw $e;
            }
        }
    }
114725
public function initialize(array $config)
    {
        $this->belongsTo('ContentTypes', [
            'className' => 'Content.ContentTypes',
            'propertyName' => 'content_type',
            'fields' => ['slug', 'name', 'description'],
            'conditions' => ['Contents.content_type_slug = ContentTypes.slug']
        ]);

        $this->belongsTo('TranslationOf', [
            'className' => 'Content\Model\Table\ContentsTable',
            'foreignKey' => 'translation_for',
            'propertyName' => 'translation_of',
            'fields' => ['slug', 'title', 'description'],
        ]);

        $this->belongsToMany('Roles', [
            'className' => 'User.Roles',
            'propertyName' => 'roles',
            'through' => 'Content.ContentsRoles',
        ]);

        $this->hasMany('ContentRevisions', [
            'className' => 'Content.ContentRevisions',
            'dependent' => true,
        ]);

        $this->hasMany('Translations', [
            'className' => 'Content\Model\Table\ContentsTable',
            'foreignKey' => 'translation_for',
            'dependent' => true,
        ]);

        $this->addBehavior('Timestamp');
        $this->addBehavior('Comment.Commentable');
        $this->addBehavior('Sluggable');
        $this->addBehavior('User.WhoDidIt', [
            'idCallable' => function () {
                return user()->get('id');
            }
        ]);
        $this->addBehavior('Field.Fieldable', [
            'bundle' => function ($entity) {
                if ($entity->has('content_type_slug')) {
                    return $entity->content_type_slug;
                }

                if ($entity->has('id')) {
                    return $this
                        ->get($entity->id, [
                            'fields' => ['id', 'content_type_slug'],
                            'fieldable' => false,
                        ])
                        ->content_type_slug;
                }

                return '';
            }
        ]);

        $this->addBehavior('Search.Searchable', [
            'fields' => function ($content) {
                $words = '';
                if ($content->has('title')) {
                    $words .= " {$content->title}";
                }

                if ($content->has('description')) {
                    $words .= " {$content->description}";
                }

                if (!$content->has('_fields')) {
                    return $words;
                }

                foreach ($content->_fields as $virtualField) {
                    $words .= " {$virtualField}";
                }

                return $words;
            }
        ]);

        $this->addSearchOperator('promote', 'operatorPromote');
        $this->addSearchOperator('author', 'operatorAuthor');
        $this->addSearchOperator('limit', 'Search.Limit');
        $this->addSearchOperator('modified', 'Search.Date', ['field' => 'modified']);
        $this->addSearchOperator('created', 'Search.Date', ['field' => 'created']);
        $this->addSearchOperator('type', 'Search.Generic', ['field' => 'content_type_slug', 'conjunction' => 'auto']);
        $this->addSearchOperator('term', 'operatorTerm');
        $this->addSearchOperator('language', 'Search.Generic', ['field' => 'language', 'conjunction' => 'auto']);
        $this->addSearchOperator('order', 'Search.Order', ['fields' => ['slug', 'title', 'description', 'sticky', 'created', 'modified']]);
    }
1364783
public function load($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'debug' => JFactory::getApplication()->getCfg('debug'),
            'wrapper_class' => array(
                JFactory::getLanguage()->isRtl() ? 'k-ui-rtl' : 'k-ui-ltr'
            )
        ));
        
        if($this->getTemplate()->decorator() === 'koowa')
        {
            $layout = $this->getTemplate()->getParameters()->layout;

            if (JFactory::getApplication()->isSite() && $layout === 'form') {
                $config->domain = 'admin';
            }
        }

        $identifier = $this->getTemplate()->getIdentifier();
        $menu       = JFactory::getApplication()->getMenu()->getActive();

        if ($identifier->type === 'com' && $menu)
        {
            if ($suffix = htmlspecialchars($menu->params->get('pageclass_sfx')))
            {
                $config->append(array(
                    'wrapper_class' => array($suffix)
                ));
            }
        }

        $html = parent::load($config);

        return $html;
    }