Commit 2b51e787 authored by alexpott's avatar alexpott

Issue #2002906 by pwieck, jibran, aaronott, chr.fritsch, chrisguindon: Rename...

Issue #2002906 by pwieck, jibran, aaronott, chr.fritsch, chrisguindon: Rename Views method get_entity() to getEntity().
parent 342f132b
......@@ -43,7 +43,7 @@ public function buildOptionsForm(&$form, &$form_state) {
public function query() {}
function render($values) {
$comment = $this->get_entity($values);
$comment = $this->getEntity($values);
return $this->render_link($comment, $values);
}
......
......@@ -39,7 +39,7 @@ public function buildOptionsForm(&$form, &$form_state) {
public function query() {}
function render($values) {
$node = $this->get_entity($values);
$node = $this->getEntity($values);
comment_node_view($node, $this->options['teaser'] ? 'teaser' : 'full');
// Only render the links if they are defined.
......
......@@ -644,7 +644,7 @@ protected function renderItems($items) {
* Return an array of items for the field.
*/
public function getItems($values) {
$original_entity = $this->get_entity($values);
$original_entity = $this->getEntity($values);
if (!$original_entity) {
return array();
}
......
......@@ -46,7 +46,7 @@ public function query() {
}
function render($values) {
if ($entity = $this->get_entity($values)) {
if ($entity = $this->getEntity($values)) {
return $this->render_link($entity, $values);
}
}
......
......@@ -67,7 +67,7 @@ function render_link($data, $values) {
*/
function get_revision_entity($values, $op) {
$vid = $this->getValue($values, 'node_vid');
$node = $this->get_entity($values);
$node = $this->getEntity($values);
// Unpublished nodes ignore access control.
$node->status = 1;
// Ensure user has access to perform the operation on this node.
......
......@@ -143,7 +143,7 @@ public function views_form_submit(&$form, &$form_state) {
$selected = array_filter($form_state['values'][$this->options['id']]);
$entities = array();
foreach (array_intersect_key($this->view->result, $selected) as $row) {
$entity = $this->get_entity($row);
$entity = $this->getEntity($row);
$entities[$entity->id()] = $entity;
}
......
......@@ -45,7 +45,7 @@ public function buildOptionsForm(&$form, &$form_state) {
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
*/
function render($values) {
return $this->render_link($this->get_entity($values), $values);
return $this->render_link($this->getEntity($values), $values);
}
/**
......
......@@ -60,7 +60,7 @@ public function query() {
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
*/
function render($values) {
return $this->render_link($this->get_entity($values), $values);
return $this->render_link($this->getEntity($values), $values);
}
/**
......
......@@ -52,7 +52,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render_link($data, $values) {
if (!empty($this->options['link_to_user']) && user_access('access user profiles') && ($entity = $this->get_entity($values)) && $data !== NULL && $data !== '') {
if (!empty($this->options['link_to_user']) && user_access('access user profiles') && ($entity = $this->getEntity($values)) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$uri = $entity->uri();
$this->options['alter']['path'] = $uri['path'];
......
......@@ -367,7 +367,7 @@ public function elementWrapperClasses($row_index = NULL) {
* @return \Drupal\Core\Entity\EntityInterface
* Returns the entity matching the values.
*/
public function get_entity(\stdClass $values) {
public function getEntity(\stdClass $values) {
$relationship_id = $this->options['relationship'];
if ($relationship_id == 'none') {
return $values->_entity;
......
......@@ -37,7 +37,7 @@ public static function getInfo() {
}
/**
* Tests the get_entity method.
* Tests the getEntity method.
*/
public function testGetEntity() {
// The view is a view of comments, their nodes and their authors, so there
......@@ -55,13 +55,13 @@ public function testGetEntity() {
$row = $view->result[0];
// Tests entities on the base level.
$entity = $view->field['cid']->get_entity($row);
$entity = $view->field['cid']->getEntity($row);
$this->assertEqual($entity->id(), $comment->id(), 'Make sure the right comment entity got loaded.');
// Tests entities as relationship on first level.
$entity = $view->field['nid']->get_entity($row);
$entity = $view->field['nid']->getEntity($row);
$this->assertEqual($entity->id(), $node->id(), 'Make sure the right node entity got loaded.');
// Tests entities as relationships on second level.
$entity = $view->field['uid']->get_entity($row);
$entity = $view->field['uid']->getEntity($row);
$this->assertEqual($entity->id(), $account->id(), 'Make sure the right user entity got loaded.');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment