Ejemplo n.º 1
0
 /**
  * Render product name to add Configure link
  *
  * @param   \Magento\Framework\DataObject $row
  * @return  string
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     $rendered = parent::render($row);
     $isConfigurable = $row->canConfigure();
     $style = $isConfigurable ? '' : 'disabled';
     $prodAttributes = $isConfigurable ? sprintf('list_type = "product_to_add" product_id = %s', $row->getId()) : 'disabled="disabled"';
     return sprintf('<a href="javascript:void(0)" class="action-configure %s" %s>%s</a>', $style, $prodAttributes, __('Configure')) . $rendered;
 }
Ejemplo n.º 2
0
 /**
  * Render integration name.
  *
  * If integration endpoint URL is unsecure then add error message to integration name.
  *
  * @param \Magento\Framework\DataObject $row
  * @return string
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     /** @var \Magento\Integration\Model\Integration $row */
     $text = parent::render($row);
     if (!$this->isUrlSecure($row->getEndpoint()) || !$this->isUrlSecure($row->getIdentityLinkUrl())) {
         $text .= '<span class="icon-error"><span>Integration not secure</span></span>';
     }
     return $text;
 }
Ejemplo n.º 3
0
 /**
  * Prepares action data for html render
  *
  * @param array &$action
  * @param string &$actionCaption
  * @param \Magento\Framework\DataObject $row
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _transformActionData(&$action, &$actionCaption, \Magento\Framework\DataObject $row)
 {
     foreach ($action as $attribute => $value) {
         if (isset($action[$attribute]) && !is_array($action[$attribute])) {
             $this->getColumn()->setFormat($action[$attribute]);
             $action[$attribute] = parent::render($row);
         } else {
             $this->getColumn()->setFormat(null);
         }
         switch ($attribute) {
             case 'caption':
                 $actionCaption = $action['caption'];
                 unset($action['caption']);
                 break;
             case 'url':
                 if (is_array($action['url']) && isset($action['field'])) {
                     $params = [$action['field'] => $this->_getValue($row)];
                     if (isset($action['url']['params'])) {
                         $params = array_merge($action['url']['params'], $params);
                     }
                     $action['href'] = $this->getUrl($action['url']['base'], $params);
                     unset($action['field']);
                 } else {
                     $action['href'] = $action['url'];
                 }
                 unset($action['url']);
                 break;
             case 'popup':
                 $action['onclick'] = 'popWin(this.href,\'_blank\',\'width=800,height=700,resizable=1,scrollbars=1\');return false;';
                 break;
         }
     }
     return $this;
 }