Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     $value = parent::render($values);
     switch ($value) {
         case LocalTaskItemInterface::STATUS_PENDING:
             $label = t('Untranslated');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
             break;
         case LocalTaskItemInterface::STATUS_COMPLETED:
             $label = t('Translated');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/gray-check.svg';
             break;
         case LocalTaskItemInterface::STATUS_REJECTED:
             $label = t('Rejected');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/rejected.svg';
             break;
         case LocalTaskItemInterface::STATUS_CLOSED:
             $label = t('Completed');
             $icon = 'core/misc/icons/73b355/check.svg';
             break;
         default:
             $label = t('Untranslated');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
     }
     $element = ['#type' => 'inline_template', '#template' => '<img src="{{ icon }}" title="{{ label }}"><span></span></img>', '#context' => array('icon' => file_create_url($icon), 'label' => $label)];
     return \Drupal::service('renderer')->render($element);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     // Only render if we exist.
     if (isset($this->tableAlias)) {
         return parent::render($values);
     }
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     if ($this->options['format'] == 'uc_length') {
         $value = $this->getValue($values);
         if (is_null($value) || $value == 0 && $this->options['empty_zero']) {
             return '';
         }
         return uc_length_format($value, $values->{$this->aliases['length_units']});
     } else {
         return parent::render($values);
     }
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     if ($this->options['format'] == 'uc_price') {
         $value = $this->getValue($values);
         if (is_null($value) || $value == 0 && $this->options['empty_zero']) {
             return '';
         }
         return uc_currency_format($value);
     } else {
         return parent::render($values);
     }
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     $value = parent::render($values);
     switch ($value) {
         case JobItemInterface::STATE_ACTIVE:
             $label = t('In progress');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/hourglass.svg';
             break;
         case JobItemInterface::STATE_REVIEW:
             $label = t('Needs review');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
             break;
         default:
             $icon = NULL;
             $label = NULL;
     }
     $element = ['#type' => 'inline_template', '#template' => '{% if label %}<img src="{{ icon }}" title="{{ label }}"><span></span></img>{% endif %}', '#context' => array('icon' => file_create_url($icon), 'label' => $label)];
     return \Drupal::service('renderer')->render($element);
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     $value = parent::render($values);
     switch ($value) {
         case JobInterface::STATE_UNPROCESSED:
             $label = t('Unprocessed');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/rejected.svg';
             break;
         case JobInterface::STATE_ACTIVE:
             $needs_review = FALSE;
             /** @var JobItemInterface $item */
             foreach ($values->_entity->getItems() as $item) {
                 if ($item->isNeedsReview()) {
                     $needs_review = TRUE;
                     break;
                 }
             }
             if ($needs_review) {
                 $label = t('Needs review');
                 $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
                 break;
             }
             $label = t('In progress');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/hourglass.svg';
             break;
         case JobInterface::STATE_CONTINUOUS:
             $label = t('Continuous');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/continuous.svg';
             break;
         case JobInterface::STATE_CONTINUOUS_INACTIVE:
             $label = t('Continuous Inactive');
             $icon = drupal_get_path('module', 'tmgmt') . '/icons/continuous_inactive.svg';
             break;
         default:
             $icon = NULL;
             $label = NULL;
     }
     $element = ['#type' => 'inline_template', '#template' => '{% if label %}<img src="{{ icon }}" title="{{ label }}"><span></span></img>{% endif %}', '#context' => ['icon' => file_create_url($icon), 'label' => $label]];
     return \Drupal::service('renderer')->render($element);
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function render(ResultRow $values)
 {
     $value = $this->getValue($values);
     if (!empty($value)) {
         return $this->renderLink(parent::render($values), $values);
     } else {
         $this->options['alter']['make_link'] = FALSE;
     }
 }