Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getItems(ResultRow $values)
 {
     $items = parent::getItems($values);
     foreach ($items as &$item) {
         // Work out the depth of this comment.
         $comment_thread = $item['rendered']['#markup'];
         $item['rendered']['#markup'] = count(explode('.', $comment_thread)) - 1;
     }
     return $items;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getItems(ResultRow $values)
 {
     $items = parent::getItems($values);
     if ($this->options['convert_spaces']) {
         foreach ($items as &$item) {
             // Replace spaces with hyphens.
             $name = $item['raw']->get('value')->getValue();
             $item['rendered']['#markup'] = str_replace(' ', '-', $name);
         }
     }
     return $items;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function getItems(ResultRow $values)
 {
     $items = parent::getItems($values);
     if ($this->options['convert_spaces']) {
         foreach ($items as &$item) {
             // Replace spaces with hyphens.
             $name = $item['raw']->get('value')->getValue();
             // @todo Add link support https://www.drupal.org/node/2567745
             $item['rendered']['#context']['value'] = str_replace(' ', '-', $name);
         }
     }
     return $items;
 }
 /**
  * {@inheritdoc}
  */
 public function getItems(ResultRow $values)
 {
     if (!$this->options['field_rendering']) {
         if ($this->fallbackHandler instanceof MultiItemsFieldHandlerInterface) {
             return $this->fallbackHandler->getItems($values);
         }
         return array();
     }
     if ($values->search_api_datasource != $this->getDatasourceId()) {
         return array();
     }
     $parent_path = $this->getParentPath();
     if (empty($values->_relationship_objects[$parent_path])) {
         return array();
     }
     $build = array();
     foreach (array_keys($values->_relationship_objects[$parent_path]) as $i) {
         $this->valueIndex = $i;
         $build[] = parent::getItems($values);
     }
     return $build ? call_user_func_array('array_merge', $build) : array();
 }