Commit dc05265a authored by webchick's avatar webchick

Issue #2003496 by NonProfit, marlatt | heddn: Rename Views method get_value() to getValue().

parent 2f820dd2
......@@ -64,8 +64,8 @@ public function buildOptionsForm(&$form, &$form_state) {
function render_link($data, $values) {
if (!empty($this->options['link_to_comment'])) {
$this->options['alter']['make_link'] = TRUE;
$nid = $this->get_value($values, 'nid');
$cid = $this->get_value($values, 'cid');
$nid = $this->getValue($values, 'nid');
$cid = $this->getValue($values, 'cid');
if (!empty($cid)) {
$this->options['alter']['path'] = "comment/" . $cid;
$this->options['alter']['fragment'] = "comment-" . $cid;
......@@ -80,7 +80,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -23,7 +23,7 @@ class Depth extends FieldPluginBase {
* Work out the depth of this comment
*/
function render($values) {
$comment_thread = $this->get_value($values);
$comment_thread = $this->getValue($values);
return count(explode('.', $comment_thread)) - 1;
}
......
......@@ -31,7 +31,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
}
function render($values) {
$comment_count = $this->get_value($values, 'comment_count');
$comment_count = $this->getValue($values, 'comment_count');
if (empty($this->options['empty_zero']) || $comment_count) {
return parent::render($values);
}
......
......@@ -24,7 +24,7 @@ public function access() {
}
function render_link($data, $values) {
$status = $this->get_value($values, 'status');
$status = $this->getValue($values, 'status');
// Don't show an approve link on published nodes.
if ($status == COMMENT_PUBLISHED) {
......@@ -32,7 +32,7 @@ function render_link($data, $values) {
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('approve');
$cid = $this->get_value($values, 'cid');
$cid = $this->getValue($values, 'cid');
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "comment/" . $cid . "/approve";
......
......@@ -25,7 +25,7 @@ public function access() {
function render_link($data, $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
$cid = $this->get_value($values, 'cid');
$cid = $this->getValue($values, 'cid');
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "comment/" . $cid . "/delete";
......
......@@ -40,7 +40,7 @@ public function buildOptionsForm(&$form, &$form_state) {
function render_link($data, $values) {
parent::render_link($data, $values);
// ensure user has access to edit this comment.
$comment = $this->get_value($values);
$comment = $this->getValue($values);
if (!$comment->access('update')) {
return;
}
......
......@@ -25,8 +25,8 @@ public function access() {
function render_link($data, $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('reply');
$nid = $this->get_value($values, 'nid');
$cid = $this->get_value($values, 'cid');
$nid = $this->getValue($values, 'nid');
$cid = $this->getValue($values, 'cid');
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "comment/reply/" . $nid . '/' . $cid;
......
......@@ -60,14 +60,14 @@ protected function defineOptions() {
function render($values) {
if (!empty($this->options['link_to_user'])) {
$account = entity_create('user', array());
$account->name = $this->get_value($values);
$account->name = $this->getValue($values);
$account->uid = $values->{$this->uid};
return theme('username', array(
'account' => $account
));
}
else {
return $this->sanitizeValue($this->get_value($values));
return $this->sanitizeValue($this->getValue($values));
}
}
......
......@@ -20,7 +20,7 @@
class NodeComment extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
switch ($value) {
case COMMENT_NODE_HIDDEN:
default:
......
......@@ -97,12 +97,12 @@ function pre_render(&$values) {
function render_link($data, $values) {
if (!empty($this->options['link_to_comment']) && $data !== NULL && $data !== '') {
$node = entity_create('node', array(
'nid' => $this->get_value($values, 'nid'),
'type' => $this->get_value($values, 'type'),
'nid' => $this->getValue($values, 'nid'),
'type' => $this->getValue($values, 'type'),
));
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'node/' . $node->nid;
$this->options['alter']['query'] = comment_new_page_count($this->get_value($values, 'comment_count'), $this->get_value($values), $node);
$this->options['alter']['query'] = comment_new_page_count($this->getValue($values, 'comment_count'), $this->getValue($values), $node);
$this->options['alter']['fragment'] = 'new';
}
......@@ -110,7 +110,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
if (!empty($value)) {
return $this->render_link(parent::render($values), $values);
}
......
......@@ -51,9 +51,9 @@ public function buildOptionsForm(&$form, &$form_state) {
function render_link($data, $values) {
if (!empty($this->options['link_to_user'])) {
$account = entity_create('user', array());
$account->uid = $this->get_value($values, 'uid');
$account->name = $this->get_value($values);
$account->homepage = $this->get_value($values, 'homepage');
$account->uid = $this->getValue($values, 'uid');
$account->name = $this->getValue($values);
$account->homepage = $this->getValue($values, 'homepage');
return theme('username', array(
'account' => $account
......@@ -65,7 +65,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -42,7 +42,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
if (!$this->options['extension_detect_tar']) {
if (preg_match('/\.([^\.]+)$/', $value, $match)) {
return $this->sanitizeValue($match[1]);
......
......@@ -59,14 +59,14 @@ public function buildOptionsForm(&$form, &$form_state) {
function render_link($data, $values) {
if (!empty($this->options['link_to_file']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = file_create_url($this->get_value($values, 'uri'));
$this->options['alter']['path'] = file_create_url($this->getValue($values, 'uri'));
}
return $data;
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -20,7 +20,7 @@
class Status extends FieldPluginBase {
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return _views_file_status($value);
}
......
......@@ -76,10 +76,10 @@ function render($values) {
$mark = MARK_READ;
global $user;
if ($user->uid) {
$last_read = $this->get_value($values);
$changed = $this->get_value($values, 'changed');
$last_read = $this->getValue($values);
$changed = $this->getValue($values, 'changed');
$last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this->get_value($values, 'last_comment') : 0;
$last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this->getValue($values, 'last_comment') : 0;
if (!$last_read && $changed > HISTORY_READ_LIMIT) {
$mark = MARK_NEW;
......
......@@ -39,7 +39,7 @@ public function buildOptionsForm(&$form, &$form_state) {
function render($values) {
// @todo: Drupal Core dropped native language until config translation is
// ready, see http://drupal.org/node/1616594.
$value = $this->get_value($values);
$value = $this->getValue($values);
$language = language_load($value);
return $language ? $language->name : '';
}
......
......@@ -39,7 +39,7 @@ public function buildOptionsForm(&$form, &$form_state) {
function render($values) {
// @todo: Drupal Core dropped native language until config translation is
// ready, see http://drupal.org/node/1616594.
$value = $this->get_value($values);
$value = $this->getValue($values);
$language = language_load($value);
$value = $language ? $language->name : '';
return $this->render_link($value, $values);
......
......@@ -67,10 +67,10 @@ function render_link($data, $values) {
if (!empty($this->options['link_to_node']) && !empty($this->additional_fields['nid'])) {
if ($data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "node/" . $this->get_value($values, 'nid');
$this->options['alter']['path'] = "node/" . $this->getValue($values, 'nid');
if (isset($this->aliases['langcode'])) {
$languages = language_list();
$langcode = $this->get_value($values, 'langcode');
$langcode = $this->getValue($values, 'langcode');
if (isset($languages[$langcode])) {
$this->options['alter']['language'] = $languages[$langcode];
}
......@@ -87,7 +87,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -54,7 +54,7 @@ public function query() {
}
function render($values) {
$nid = $this->get_value($values, 'nid');
$nid = $this->getValue($values, 'nid');
return url("node/$nid", array('absolute' => $this->options['absolute']));
}
......
......@@ -62,11 +62,11 @@ public function buildOptionsForm(&$form, &$form_state) {
function render_link($data, $values) {
if (!empty($this->options['link_to_node_revision']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$nid = $this->get_value($values, 'nid');
$vid = $this->get_value($values, 'vid');
$nid = $this->getValue($values, 'nid');
$vid = $this->getValue($values, 'vid');
$this->options['alter']['path'] = "node/" . $nid . '/revisions/' . $vid . '/view';
if (module_exists('translation')) {
$langcode = $this->get_value($values, 'langcode');
$langcode = $this->getValue($values, 'langcode');
$languages = language_list();
if (isset($languages[$langcode])) {
$this->options['alter']['langcode'] = $languages[$langcode];
......
......@@ -66,7 +66,7 @@ function render_link($data, $values) {
* revision ID for this row.
*/
function get_revision_entity($values, $op) {
$vid = $this->get_value($values, 'node_vid');
$vid = $this->getValue($values, 'node_vid');
$node = $this->get_entity($values);
// Unpublished nodes ignore access control.
$node->status = 1;
......
......@@ -51,7 +51,7 @@ function render_name($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->render_name($value, $values), $values);
}
......
......@@ -140,7 +140,7 @@ public function render($row) {
// If this is not unknown and the raw output option has been set, just get
// the raw value.
if (($field->field_alias != 'unknown') && !empty($this->rawOutputOptions[$id])) {
$value = $field->sanitizeValue($field->get_value($row), 'xss_admin');
$value = $field->sanitizeValue($field->getValue($row), 'xss_admin');
}
// Otherwise, pass this through the field render() method.
else {
......
......@@ -20,7 +20,7 @@ class Language extends Taxonomy {
* Overrides Drupal\taxonomy\Plugin\views\field\Taxonomy::render().
*/
public function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
$language = language_load($value);
$value = $language ? $language->name : '';
......
......@@ -55,7 +55,7 @@ public function query() {
function render($values) {
// Check there is an actual value, as on a relationship there may not be.
if ($tid = $this->get_value($values, 'tid')) {
if ($tid = $this->getValue($values, 'tid')) {
// Mock a term object for taxonomy_term_access(). Use machine name and
// vid to ensure compatibility with vid based and machine name based
// access checks. See http://drupal.org/node/995156
......
......@@ -69,11 +69,11 @@ public function buildOptionsForm(&$form, &$form_state) {
* Data should be made XSS safe prior to calling this function.
*/
function render_link($data, $values) {
$tid = $this->get_value($values, 'tid');
$tid = $this->getValue($values, 'tid');
if (!empty($this->options['link_to_taxonomy']) && !empty($tid) && $data !== NULL && $data !== '') {
$term = entity_create('taxonomy_term', array(
'tid' => $tid,
'vid' => $this->get_value($values, 'vid'),
'vid' => $this->getValue($values, 'vid'),
));
$this->options['alter']['make_link'] = TRUE;
$uri = $term->uri();
......@@ -88,7 +88,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -19,9 +19,9 @@
class Language extends User {
function render_link($data, $values) {
$uid = $this->get_value($values, 'uid');
$uid = $this->getValue($values, 'uid');
if (!empty($this->options['link_to_user'])) {
$uid = $this->get_value($values, 'uid');
$uid = $this->getValue($values, 'uid');
if (user_access('access user profiles') && $uid) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'user/' . $uid;
......@@ -39,7 +39,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -76,15 +76,15 @@ public function buildOptionsForm(&$form, &$form_state) {
function render_link($data, $values) {
$account = entity_create('user', array());
$account->uid = $this->get_value($values, 'uid');
$account->name = $this->get_value($values);
$account->uid = $this->getValue($values, 'uid');
$account->name = $this->getValue($values);
if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
// This is an anonymous user, and we're overriting the text.
return check_plain($this->options['anonymous_text']);
}
elseif (!empty($this->options['link_to_user'])) {
$account->name = $this->get_value($values);
$account->name = $this->getValue($values);
return theme('username', array('account' => $account));
}
}
......
......@@ -40,7 +40,7 @@ function pre_render(&$values) {
$this->items = array();
foreach ($values as $result) {
$uids[] = $this->get_value($result);
$uids[] = $this->getValue($result);
}
if ($uids) {
......
......@@ -40,7 +40,7 @@ function pre_render(&$values) {
$this->items = array();
foreach ($values as $result) {
$uids[] = $this->get_value($result);
$uids[] = $this->getValue($result);
}
if ($uids) {
......
......@@ -61,7 +61,7 @@ function render_link($data, $values) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
}
......
......@@ -78,7 +78,7 @@ public function buildOptionsForm(&$form, &$form_state) {
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
*/
function render($values) {
$uid = $this->get_value($values);
$uid = $this->getValue($values);
$data = $this->userData->get($this->options['module'], $uid, $this->options['name']);
// Don't sanitize if no value was found.
......
......@@ -991,7 +991,7 @@ public function setArgument($arg) {
/**
* Get the value of this argument.
*/
function get_value() {
public function getValue() {
// If we already processed this argument, we're done.
if (isset($this->argument)) {
return $this->argument;
......
......@@ -101,7 +101,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
if (!empty($this->options['not'])) {
$value = !$value;
}
......
......@@ -41,9 +41,9 @@ public function query() {
}
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBas::get_value()
* {@inheritdoc}
*/
public function get_value($values, $field = NULL) {
public function getValue($values, $field = NULL) {
// Note: 1 is subtracted from the counter start value below because the
// counter value is incremented by 1 at the end of this function.
$count = is_numeric($this->options['counter_start']) ? $this->options['counter_start'] - 1 : 0;
......
......@@ -80,7 +80,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
$format = $this->options['date_format'];
if (in_array($format, array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span'))) {
$custom_format = $this->options['custom_date_format'];
......
......@@ -388,7 +388,7 @@ public function get_entity(\stdClass $values) {
* @param $field
* Optional name of the field where the value is stored.
*/
function get_value($values, $field = NULL) {
public function getValue($values, $field = NULL) {
$alias = isset($field) ? $this->aliases[$field] : $this->field_alias;
if (isset($values->{$alias})) {
return $values->{$alias};
......@@ -1098,7 +1098,7 @@ function pre_render(&$values) { }
* The values retrieved from the database.
*/
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
return $this->sanitizeValue($value);
}
......
......@@ -39,7 +39,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
if ($value) {
switch ($this->options['file_size_display']) {
case 'bytes':
......
......@@ -41,9 +41,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
if (is_array($this->format)) {
$format = $this->get_value($values, 'format');
$format = $this->getValue($values, 'format');
}
else {
$format = $this->format;
......
......@@ -125,7 +125,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);
if (!empty($this->options['set_precision'])) {
$value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']);
}
......
......@@ -100,7 +100,7 @@ function render_items($items) {
* should also be in this array.
*/
function get_items($values) {
$field = $this->get_value($values);
$field = $this->getValue($values);
if (!empty($this->items[$field])) {
return $this->items[$field];
}
......
......@@ -39,7 +39,7 @@ public function buildOptionsForm(&$form, &$form_state) {
}
function render($values) {
$value = $this->get_value($values);
$value = $this->getValue($values);