/** * {@inheritdoc} */ public function prepareRow(Row $row) { $roles = $this->select('users_roles', 'ur')->fields('ur', ['rid'])->condition('ur.uid', $row->getSourceProperty('uid'))->execute()->fetchCol(); $row->setSourceProperty('roles', $roles); $row->setSourceProperty('data', unserialize($row->getSourceProperty('data'))); // Get Field API field values. foreach (array_keys($this->getFields('user')) as $field) { $row->setSourceProperty($field, $this->getFieldValues('user', $field, $row->getSourceProperty('uid'))); } // Get profile field values. This code is lifted directly from the D6 // ProfileFieldValues plugin. if ($this->getDatabase()->schema()->tableExists('profile_value')) { $query = $this->select('profile_value', 'pv')->fields('pv', array('fid', 'value')); $query->leftJoin('profile_field', 'pf', 'pf.fid=pv.fid'); $query->fields('pf', array('name', 'type')); $query->condition('uid', $row->getSourceProperty('uid')); $results = $query->execute(); foreach ($results as $profile_value) { if ($profile_value['type'] == 'date') { $date = unserialize($profile_value['value']); $date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year'])); $row->setSourceProperty($profile_value['name'], array('value' => $date)); } elseif ($profile_value['type'] == 'list') { // Explode by newline and comma. $row->setSourceProperty($profile_value['name'], preg_split("/[\r\n,]+/", $profile_value['value'])); } else { $row->setSourceProperty($profile_value['name'], array($profile_value['value'])); } } } return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { // Get Field API field values. foreach (array_keys($this->getFields('node', $row->getSourceProperty('type'))) as $field) { $nid = $row->getSourceProperty('nid'); $vid = $row->getSourceProperty('vid'); $row->setSourceProperty($field, $this->getFieldValues('node', $field, $nid, $vid)); } return parent::prepareRow($row); }
/** * {@inheritdoc} */ public function prepareRow(Row $row) { $cid = $row->getSourceProperty('cid'); $node_type = $row->getSourceProperty('node_type'); $comment_type = 'comment_node_' . $node_type; $row->setSourceProperty('comment_type', 'comment_node_' . $node_type); foreach (array_keys($this->getFields('comment', $comment_type)) as $field) { $row->setSourceProperty($field, $this->getFieldValues('comment', $field, $cid)); } return parent::prepareRow($row); }