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?

asked Sep 5, 2017 at 9:09
1
  • try to extend with \Magento\Framework\Data\Form\Element\Image Commented Sep 5, 2017 at 9:11

1 Answer 1

0

Try :

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

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

answered Sep 5, 2017 at 9:11
1
  • No worries man! Commented Sep 5, 2017 at 9:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.