<commit_before><?php

/**
 * Allows user to pick a Font Awesome Icon
 *
 * @author  <NAME> <<EMAIL>>
 * @package  silverstripe-fontawesome-iconpickerfield
 */
class FontAwesomeIconPickerField extends TextField {

    public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null){
        parent::__construct($name, $title, $value, $maxLength, $form);
    }

    public function Field($properties = array()) {
        $this->addExtraClass('form-control icp icp-auto');
        Requirements::css('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css');
        Requirements::css('//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css');
        Requirements::css(FONTAWESOMEICONPICKER_DIR . '/code/thirdparty/fontawesome-iconpicker-1.0.0/dist/css/fontawesome-iconpicker.min.css');

        Requirements::set_force_js_to_bottom(true);
        Requirements::javascript(FONTAWESOMEICONPICKER_DIR . '/code/thirdparty/fontawesome-iconpicker-1.0.0/dist/js/fontawesome-iconpicker.js');

        Requirements::customScript(<<<JS
            jQuery(function() {
                jQuery('.icp-auto').iconpicker();
            });
JS
    );

        return parent::Field($properties);
    }

    /**
     * Override the type to get the proper class name on the field
     * "text" is needed here to render the form field as a normal text-field
     * @see FormField::Type()
     */
    public function Type(){
        return 'text';
    }

    /**
     * Ensure the value is a valid Font Awesome value beginning with 'fa-'
     * @see FormField::validate()
     */
    public function validate($validator)
    {
        if(!empty ($this->value) && !preg_match('/^fa-[a-z]+/', $this->value))
        {<commit_msg>change fontawesome picker styling from border-box to content-box<commit_after><?php

/**
 * Allows user to pick a Font Awesome Icon
 *
 * @author  <NAME> <<EMAIL>>
 * @package  silverstripe-fontawesome-iconpickerfield
 */
class FontAwesomeIconPickerField extends TextField {

    public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null){
        parent::__construct($name, $title, $value, $maxLength, $form);
    }

    public function Field($properties = array()) {
        $this->addExtraClass('form-control icp icp-auto');
        Requirements::css('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css');
        Requirements::css('//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css');
        Requirements::css(FONTAWESOMEICONPICKER_DIR . '/code/thirdparty/fontawesome-iconpicker-1.0.0/dist/css/fontawesome-iconpicker.min.css');
        Requirements::customCSS('* { box-sizing: content-box; }');

        Requirements::set_force_js_to_bottom(true);
        Requirements::javascript(FONTAWESOMEICONPICKER_DIR . '/code/thirdparty/fontawesome-iconpicker-1.0.0/dist/js/fontawesome-iconpicker.js');

        Requirements::customScript(<<<JS
            jQuery(function() {
                jQuery('.icp-auto').iconpicker();
            });
JS
    );

        return parent::Field($properties);
    }

    /**
     * Override the type to get the proper class name on the field
     * "text" is needed here to render the form field as a normal text-field
     * @see FormField::Type()
     */
    public function Type(){
        return 'text';
    }

    /**
     * Ensure the value is a valid Font Awesome value beginning with 'fa-'
     * @see FormField::validate()
     */
    public function validate($validator)
    {
        if(!empty ($this->value) && !preg_match('/^fa-[a-z]+/', $this->value))
        {
{'fraction_non_alphanumeric': 0.14906490649064907, 'fraction_numerical': 0.006600660066006601, 'mean_word_length': 2.983570646221249, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '7539104', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1127, 'n_words': 222}