You are here

public function MaestroEngineActiveAssignments::render in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/field/MaestroEngineActiveAssignments.php \Drupal\maestro\Plugin\views\field\MaestroEngineActiveAssignments::render()

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides FieldPluginBase::render

File

src/Plugin/views/field/MaestroEngineActiveAssignments.php, line 62

Class

MaestroEngineActiveAssignments
Field handler to generate a list of assigned users/roles etc.

Namespace

Drupal\maestro\Plugin\views\field

Code

public function render(ResultRow $values) {
  $item = $values->_entity;
  $output = '';

  // Lets get the assignments based on this queue ID.
  $assignees = MaestroEngine::getAssignedNamesOfQueueItem($item->id
    ->getString(), TRUE);
  if (count($assignees) == 0) {
    return $this
      ->t('No assignees');
  }
  else {
    foreach ($assignees as $arr) {
      if ($output != '') {
        $output .= $this->options['separator_text'];
      }
      $output .= $arr['assign_id'];
      if ($this->options['show_how_assigned']) {
        $output .= $arr['by_variable'];
      }
    }
    return [
      '#markup' => $output,
    ];
  }
}