<commit_before><?php

namespace Croogo\Core\View\Helper;

use BootstrapUI\View\Helper\FormHelper;
use Cake\Utility\Inflector;
use Cake\Utility\Hash;
use Cake\View\View;
use Croogo\Extensions\CroogoTheme;

/**
 * Croogo Form Helper
 *
 * @package Croogo.Croogo.View.Helper
 */
class CroogoFormHelper extends FormHelper
{

    public $helpers = [
        'Html',
        'Url',
        'Croogo/Core.Theme',
        'Croogo/Core.Croogo',
        'Croogo/Core.CroogoHtml',
    ];

/**
 * Constructor
 */
    public function __construct(View $View, $settings = [])
    {
        $settings = Hash::merge([
            'widgets' => [
                'stringlist' => [
                    'Croogo/Core.StringList',
                    'textarea',
                    'label',
                ],
                'datetime' => ['Croogo/Core.DateTime', 'select']
            ],
        ], $settings);

        if ($View->theme) {
            $themeConfig = CroogoTheme::config($View->theme);
            $themeSettings = $themeConfig['settings'];
            $settings = Hash::merge($themeSettings, $settings);
        }

        $this->_templates['dateWidget'] = '<ul class="list-inline"><li class="year list-inline-item">{{year}}</li><li class="month list-inline-item">{{month}}</li><li class="day list-inline-item">{{day}}</li><li class="hour list-inline-item">{{hour}}</li><li class="minute list-inline-item">{{minute}}</li><li class="second list-inline-item">{{second}}</li><li class="meridian list-inline-item">{{meridian}}</li></ul>';
        $this->_templates['file'] = '<input type="file" name="{{name}}"{{attrs}}><span class="file-custom"></span>';
        $this->_templates['inputContainerError'] = '<div class="form-group {{type}}{{required}} has-danger">{{content}}{{error}}{{help}}</div>';

        parent::__construct($View, $settings);
    }

    protected function _tooltip($options)
    {
        if ($options['tooltip'] === false) {
            unset($options['title']);
            return $options;
        }
        $tooltipOptions = [
            'data-placement' => 'right',
            'data-trigger' => 'focus',
        ];
        if (is_string($options['tooltip'])) {<commit_msg>Improve display of help and error messages in admin<commit_after><?php

namespace Croogo\Core\View\Helper;

use BootstrapUI\View\Helper\FormHelper;
use Cake\Utility\Inflector;
use Cake\Utility\Hash;
use Cake\View\View;
use Croogo\Extensions\CroogoTheme;

/**
 * Croogo Form Helper
 *
 * @package Croogo.Croogo.View.Helper
 */
class CroogoFormHelper extends FormHelper
{

    public $helpers = [
        'Html',
        'Url',
        'Croogo/Core.Theme',
        'Croogo/Core.Croogo',
        'Croogo/Core.CroogoHtml',
    ];

/**
 * Constructor
 */
    public function __construct(View $View, $settings = [])
    {
        $settings = Hash::merge([
            'widgets' => [
                'stringlist' => [
                    'Croogo/Core.StringList',
                    'textarea',
                    'label',
                ],
                'datetime' => ['Croogo/Core.DateTime', 'select']
            ],
        ], $settings);

        if ($View->theme) {
            $themeConfig = CroogoTheme::config($View->theme);
            $themeSettings = $themeConfig['settings'];
            $settings = Hash::merge($themeSettings, $settings);
        }

        $this->_templates['dateWidget'] = '<ul class="list-inline"><li class="year list-inline-item">{{year}}</li><li class="month list-inline-item">{{month}}</li><li class="day list-inline-item">{{day}}</li><li class="hour list-inline-item">{{hour}}</li><li class="minute list-inline-item">{{minute}}</li><li class="second list-inline-item">{{second}}</li><li class="meridian list-inline-item">{{meridian}}</li></ul>';
        $this->_templates['file'] = '<input type="file" name="{{name}}"{{attrs}}><span class="file-custom"></span>';
        $this->_templates['inputContainerError'] = '<div class="form-group {{type}}{{required}} has-danger">{{content}}{{help}}{{error}}</div>';
        $this->_templates['error'] = '<p class="text-danger">{{content}}</p>';
        $this->_templates['help'] = '<small class="text-muted">{{content}}</small>';

        parent::__construct($View, $settings);
    }

    protected function _tooltip($options)
    {
        if ($options['tooltip'] === false) {
            unset($options['title']);
            return $options;
        }
        $tooltipOptions = [
            'data-placement' => 'right',
            'data-trigger' => 'focus',
        ];
        if (is_string($options['tooltip'])) {
{'fraction_non_alphanumeric': 0.1952069716775599, 'fraction_numerical': 0.0, 'mean_word_length': 2.640761300555115, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6069768', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1316, 'n_words': 214}