Skip to content
Snippets Groups Projects
Commit 63f6f48a authored by Leonid Poluyanov's avatar Leonid Poluyanov
Browse files

MAGETWO-57989: Unable to create custom image attribute in category

parent 4b3c9cc3
No related merge requests found
......@@ -81,6 +81,30 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Category
?: \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Eav\Model\Config::class);
}
/**
* Filter category data
*
* @deprecated
* @param array $rawData
* @return array
*/
protected function _filterCategoryPostData(array $rawData)
{
$data = $rawData;
if (isset($data['image']) && is_array($data['image'])) {
if (!empty($data['image']['delete'])) {
$data['image'] = null;
} else {
if (isset($data['image'][0]['name']) && isset($data['image'][0]['tmp_name'])) {
$data['image'] = $data['image'][0]['name'];
} else {
unset($data['image']);
}
}
}
return $data;
}
/**
* Category save
*
......@@ -239,7 +263,7 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Category
* @param array $data
* @return array
*/
public function imagePreprocessing(array $data)
public function imagePreprocessing($data)
{
$entityType = $this->eavConfig->getEntityType(CategoryAttributeInterface::ENTITY_TYPE_CODE);
......
......@@ -293,7 +293,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
->isObjectNew(true);
$repository->save($model);
$this->assertNull($model->getImage());
$this->assertEmpty($model->getImage());
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment