/** * Prepare page object * * @param array $data * @return \Magento\Framework\Object */ protected function _prepareObject(array $data) { $object = new \Magento\Framework\Object(); $object->setId($data[$this->getIdFieldName()]); $object->setUrl($data['url']); $object->setUpdatedAt($data['updated_at']); return $object; }
/** * Add new massaction item * * Item array to be passed in looks like: * $item = array( * 'label' => string, * 'complete' => string, // Only for ajax enabled grid (optional) * 'url' => string, * 'confirm' => string, // text of confirmation of this action (optional) * 'additional' => string // (optional) * ); * * @param string $itemId * @param array|\Magento\Framework\Object $item * @return $this */ public function addItem($itemId, $item) { if (is_array($item)) { $item = new \Magento\Framework\Object($item); } if ($item instanceof \Magento\Framework\Object) { $item->setId($itemId); $item->setUrl($this->getUrl($item->getUrl())); $this->_items[$itemId] = $item; } return $this; }
/** * Prepare category * * @param array $categoryRow * @return \Magento\Framework\Object */ protected function _prepareCategory(array $categoryRow) { $category = new \Magento\Framework\Object(); $category->setId($categoryRow[$this->getIdFieldName()]); $categoryUrl = !empty($categoryRow['url']) ? $categoryRow['url'] : 'catalog/category/view/id/' . $category->getId(); $category->setUrl($categoryUrl); $category->setUpdatedAt($categoryRow['updated_at']); return $category; }
/** * Returns special download params (if needed) for custom option with type = 'file'. * Needed to implement \Magento\Catalog\Model\Product\Configuration\Item\Interface. * * We have to customize only controller url, so return it. * * @return null|\Magento\Framework\Object */ public function getFileDownloadParams() { $params = new \Magento\Framework\Object(); $params->setUrl($this->_customOptionDownloadUrl); return $params; }