Exemplo n.º 1
0
 /**
  * @param array $items
  * @return array
  */
 public function prepareItems(array &$items)
 {
     foreach ($items as &$item) {
         if (isset($item['page_id'])) {
             $item[$this->getData('name')]['edit'] = ['href' => $this->urlBuilder->getUrl(static::URL_PATH, ['page_id' => $item['page_id']]), 'label' => __('Edit'), 'hidden' => true];
         }
         if (isset($item['identifier'])) {
             $item[$this->getData('name')]['preview'] = ['href' => $this->actionUrlBuilder->getUrl($item['identifier'], isset($item['_first_store_id']) ? $item['_first_store_id'] : null, isset($item['store_code']) ? $item['store_code'] : null), 'label' => __('Preview')];
         }
     }
     return $items;
 }
Exemplo n.º 2
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             if (isset($item['page_id'])) {
                 $item[$this->getData('name')]['edit'] = ['href' => $this->urlBuilder->getUrl($this->url, ['page_id' => $item['page_id']]), 'label' => __('Edit'), 'hidden' => true];
             }
             if (isset($item['identifier'])) {
                 $item[$this->getData('name')]['preview'] = ['href' => $this->actionUrlBuilder->getUrl($item['identifier'], isset($item['_first_store_id']) ? $item['_first_store_id'] : null, isset($item['store_code']) ? $item['store_code'] : null), 'label' => __('Preview')];
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             $name = $this->getData('name');
             if (isset($item['page_id'])) {
                 $item[$name]['edit'] = ['href' => $this->urlBuilder->getUrl($this->editUrl, ['page_id' => $item['page_id']]), 'label' => __('Edit')];
                 $item[$name]['delete'] = ['href' => $this->urlBuilder->getUrl(self::CMS_URL_PATH_DELETE, ['page_id' => $item['page_id']]), 'label' => __('Delete'), 'confirm' => ['title' => __('Delete "${ $.$data.title }"'), 'message' => __('Are you sure you wan\'t to delete a "${ $.$data.title }" record?')]];
             }
             if (isset($item['identifier'])) {
                 $item[$name]['preview'] = ['href' => $this->actionUrlBuilder->getUrl($item['identifier'], isset($item['_first_store_id']) ? $item['_first_store_id'] : null, isset($item['store_code']) ? $item['store_code'] : null), 'label' => __('Preview')];
             }
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Get data
  *
  * @param array $dataRow
  * @return mixed
  */
 public function getData(array $dataRow)
 {
     return ['edit' => ['href' => $this->urlBuilder->getUrl(static::URL_PATH, ['page_id' => $dataRow['page_id']]), 'label' => __('Edit'), 'hidden' => true], 'preview' => ['href' => $this->actionUrlBuilder->getUrl($dataRow['identifier'], isset($dataRow['_first_store_id']) ? $dataRow['_first_store_id'] : null, isset($dataRow['store_code']) ? $dataRow['store_code'] : null), 'label' => __('Preview')]];
 }
Exemplo n.º 5
0
 /**
  * Get data
  *
  * @param array $rowData
  * @param array $rowActionConfig
  * @return array
  */
 public function getData(array $rowData, array $rowActionConfig = [])
 {
     return ['edit' => ['href' => $this->urlBuilder->getUrl(isset($rowActionConfig['url_path']) ? $rowActionConfig['url_path'] : static::URL_PATH, ['page_id' => $rowData['page_id']]), 'label' => __('Edit'), 'hidden' => true], 'preview' => ['href' => $this->actionUrlBuilder->getUrl($rowData['identifier'], isset($rowData['_first_store_id']) ? $rowData['_first_store_id'] : null, isset($rowData['store_code']) ? $rowData['store_code'] : null), 'label' => __('Preview')]];
 }