src/Helpers/Form.php
public function getData($name, $attr)
    {
        if (empty($name)) {
            return $attr;
        }

        $value = $this->Data->getValue($name);

        if ($value !== null) {
            $isCheckbox = (isset($attr['type']) && $attr['type'] == 'checkbox');
            $isRadio = (isset($attr['type']) && $attr['type'] == 'radio');
            $isSelect = (isset($attr['type']) && $attr['type'] == 'select');

            if ($isCheckbox) {
                $attr[] = 'checked';
            } elseif ($isRadio) {
                $attr['checked'] = $value;
            } elseif ($isSelect) {
                $attr['selected'] = $value;
            } else {
                $attr['value'] = $value;
            }
        }

        return $attr;
    }
public function getData($name, $attr)
    {
        if (empty($name)) {
            return $attr;
        }

        $value = $this->Data->getValue($name);

        if ($value !== null) {
            $isCheckbox = (isset($attr['type']) && $attr['type'] == 'checkbox');
            $isRadio = (isset($attr['type']) && $attr['type'] == 'radio');
            $isSelect = (isset($attr['type']) && $attr['type'] == 'select');

            if ($isCheckbox) {
                $attr[] = 'checked';
            } elseif ($isRadio) {
                $attr['checked'] = $value;
            } elseif ($isSelect) {
                $attr['selected'] = $value;
            } else {
                $attr['value'] = $value;
            }
        }

        return $attr;
    }
public function getData ( $ name , $ attr ) { if ( empty ( $ name ) ) { return $ attr ; } $ value = $ this -> Data -> getValue ( $ name ) ; if ( $ value !== null ) { $ isCheckbox = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'checkbox' ) ; $ isRadio = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'radio' ) ; $ isSelect = ( isset ( $ attr [ 'type' ] ) && $ attr [ 'type' ] == 'select' ) ; if ( $ isCheckbox ) { $ attr [ ] = 'checked' ; } elseif ( $ isRadio ) { $ attr [ 'checked' ] = $ value ; } elseif ( $ isSelect ) { $ attr [ 'selected' ] = $ value ; } else { $ attr [ 'value' ] = $ value ; } } return $ attr ; }
use the Data interface and find any post data

@param   string          input name (dot notation for multi-dimensional array)
@param   array   Array of attributes for the tag
@return  array   Return the attribute array with added post data
use the Data interface and find any post data