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;
    }