dwightwatson / bootstrap-form

Bootstrap 3 form builder for Laravel
MIT License
217 stars 133 forks source link

Add Placeholder automatic #105

Closed Erisbv-zz closed 6 years ago

Erisbv-zz commented 6 years ago

Add automatic placeholde in the input field within the input method

Erisbv-zz commented 6 years ago

public function input($type, $name, $label = null, $value = null, array $options = []) { $label = $this->getLabelTitle($label, $name);

    $optionsField = $this->getFieldOptions(array_except($options, ['suffix', 'prefix']), $name);

    $inputElement = '';
/* ---------- */
    if (!isset($options['placeholder'])) {
        $label_name = is_array($label)? $label['html'] : $label;
        $optionsField['placeholder'] = preg_replace('/[^A-Za-z0-9\-]/', '', strip_tags($label_name));
    }`

/ ---------- /

dwightwatson commented 6 years ago

I don’t understand what this code does. Can’t you already pass a placeholder as an option and have it applied to the input?

Please provide a PR with a clearer description of the feature and I’ll be more than happy to review it.