<commit_before><?php

namespace Encore\Admin\Form\Field;

use Encore\Admin\Form\Field;

class Text extends Field
{
    use PlainInput;

    protected $content;

    protected $icon = 'fa-pencil';

    /**
     * To change Text input value
     * @param string $content
     */
    public function content($content = '')
    {
        if (is_callable($content)) {
            $this->content = $content;
        } else {
            $this->content = (string)$content;
        }

        return $this;
    }

    public function icon($icon)
    {
        $this->icon = $icon;

        return $this;
    }

    /**
     * Render this filed.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function render()
    {
        $this->initPlainInput();

        if ($this->content instanceof \Closure) {
            if ($this->form) {
                $valueAttribute = call_user_func($this->content, $this->form->model());
            } else {
                $valueAttribute = call_user_func($this->content, $this->value);
            }
        } else {
            $valueAttribute = old($this->column, $this->value());
        }

        $this->prepend('<i class="fa ' . $this->icon . '"></i>')
            ->defaultAttribute('type', 'text')
            ->defaultAttribute('id', $this->id)
            ->defaultAttribute('name', $this->elementName ?: $this->formatName($this->column))
            ->defaultAttribute('value', $valueAttribute)
            ->defaultAttribute('class', 'form-control ' . $this->getElementClassString())<commit_msg>text input content function passes the whole form object not model only.<commit_after><?php

namespace Encore\Admin\Form\Field;

use Encore\Admin\Form\Field;

class Text extends Field
{
    use PlainInput;

    protected $content;

    protected $icon = 'fa-pencil';

    /**
     * To change Text input value
     * @param string $content
     */
    public function content($content = '')
    {
        if (is_callable($content)) {
            $this->content = $content;
        } else {
            $this->content = (string)$content;
        }

        return $this;
    }

    public function icon($icon)
    {
        $this->icon = $icon;

        return $this;
    }

    /**
     * Render this filed.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function render()
    {
        $this->initPlainInput();

        if ($this->content instanceof \Closure) {
            if ($this->form) {
                $valueAttribute = call_user_func($this->content, $this->form);
            } else {
                $valueAttribute = call_user_func($this->content, $this->value);
            }
        } else {
            $valueAttribute = old($this->column, $this->value());
        }

        $this->prepend('<i class="fa ' . $this->icon . '"></i>')
            ->defaultAttribute('type', 'text')
            ->defaultAttribute('id', $this->id)
            ->defaultAttribute('name', $this->elementName ?: $this->formatName($this->column))
            ->defaultAttribute('value', $valueAttribute)
            ->defaultAttribute('class', 'form-control ' . $this->getElementClassString())
{'fraction_non_alphanumeric': 0.1550652579241765, 'fraction_numerical': 0.0, 'mean_word_length': 2.019699812382739, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 56, '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': '2324257', 'n_tokens_mistral': 916, 'n_tokens_neox': 901, 'n_words': 180}