0

I have a custom module and i tried to extend this class in my Image.php file: Magento\Framework\Data\Form\Element\Image

namespace Vendor\Namespace\Block\Adminhtml\Form\Element;

class Image extends Magento\Framework\Data\Form\Element\Image
{ 
    /**
     * Get image preview url
     *
     * @return string
     */
    protected function _getUrl()
    {
        return $this->getValue();
    }
}

When i run the compile command i receive this err: 14% 1 sec 52.0 MiBPHP Fatal error: Class 'vendor\namespace\Block\Adminhtml\Form\Element\Magento\Framework\Data\Form\Element\Image' not found in app/code/vendorm/namespace/Block/Adminhtml/Form/Element/Image.php on line 9.

Even this class exist at this path, i still receive this error.

Does anyone know why this happen?

  • try to extend with \Magento\Framework\Data\Form\Element\Image – Keyur Shah Sep 5 '17 at 9:11
0

Try :

class Image extends \Magento\Framework\Data\Form\Element\Image

Without the \ Magento is looking within the module for the class.

  • No worries man! – harri Sep 5 '17 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.