Commit 6bec9b2f authored by webchick's avatar webchick

Issue #2056943 by alexpott, damiankloip: Convert render_link() to renderLink.

parent 6b9e9ff2
......@@ -65,7 +65,7 @@ public function buildOptionsForm(&$form, &$form_state) {
* @return data
* Returns string for the link text.
*/
protected function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$cid = $this->getValue($values, 'cid');
if (!empty($this->options['link_to_category']) && !empty($cid) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
......@@ -79,7 +79,7 @@ protected function render_link($data, ResultRow $values) {
*/
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -60,7 +60,7 @@ public function buildOptionsForm(&$form, &$form_state) {
*/
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
/**
......@@ -74,7 +74,7 @@ public function render($values) {
* @return data
* Returns string for the link text.
*/
protected function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$link = $this->getValue($values, 'link');
if (!empty($this->options['display_as_link'])) {
$this->options['alter']['make_link'] = TRUE;
......
......@@ -62,7 +62,7 @@ public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_comment'])) {
$this->options['alter']['make_link'] = TRUE;
$nid = $this->getValue($values, 'nid');
......@@ -82,7 +82,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -45,10 +45,10 @@ public function query() {}
public function render($values) {
$comment = $this->getEntity($values);
return $this->render_link($comment, $values);
return $this->renderLink($comment, $values);
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('view');
$comment = $data;
$nid = $comment->nid;
......
......@@ -24,7 +24,7 @@ public function access() {
return user_access('administer comments');
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$status = $this->getValue($values, 'status');
// Don't show an approve link on published nodes.
......
......@@ -24,7 +24,7 @@ public function access() {
return user_access('administer comments');
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
$cid = $this->getValue($values, 'cid');
......
......@@ -37,8 +37,8 @@ public function buildOptionsForm(&$form, &$form_state) {
);
}
function render_link($data, ResultRow $values) {
parent::render_link($data, $values);
protected function renderLink($data, ResultRow $values) {
parent::renderLink($data, $values);
// Ensure user has access to edit this comment.
$comment = $this->getValue($values);
if (!$comment->access('update')) {
......
......@@ -24,7 +24,7 @@ public function access() {
return user_access('post comments');
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('reply');
$nid = $this->getValue($values, 'nid');
$cid = $this->getValue($values, 'cid');
......
......@@ -128,7 +128,7 @@ public function preRender(&$values) {
}
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_comment']) && $data !== NULL && $data !== '') {
$node = entity_create('node', array(
'nid' => $this->getValue($values, 'nid'),
......@@ -146,7 +146,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
if (!empty($value)) {
return $this->render_link(parent::render($values), $values);
return $this->renderLink(parent::render($values), $values);
}
else {
$this->options['alter']['make_link'] = FALSE;
......
......@@ -49,7 +49,7 @@ public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_user'])) {
$account = entity_create('user', array());
$account->uid = $this->getValue($values, 'uid');
......@@ -68,7 +68,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -43,7 +43,7 @@ public function access() {
/**
* {@inheritdoc}
*/
public function render_link(EntityInterface $entity, ResultRow $values) {
protected function renderLink(EntityInterface $entity, ResultRow $values) {
if (empty($entity)) {
return;
......
......@@ -46,7 +46,7 @@ public function buildOptionsForm(&$form, &$form_state) {
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
*/
public function render($values) {
return $this->render_link($this->getEntity($values), $values);
return $this->renderLink($this->getEntity($values), $values);
}
/**
......@@ -60,7 +60,7 @@ public function render($values) {
* @return string
* The acutal rendered text (without the link) of this field.
*/
public function render_link(EntityInterface $entity, ResultRow $values) {
protected function renderLink(EntityInterface $entity, ResultRow $values) {
if (content_translation_translate_access($entity)) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('translate');
......
......@@ -57,7 +57,7 @@ public function buildOptionsForm(&$form, &$form_state) {
*
* Data should be made XSS safe prior to calling this function.
*/
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $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->getValue($values, 'uri'));
......@@ -68,7 +68,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -43,7 +43,7 @@ public function render($values) {
$data = drupal_render($file_icon);
}
return $this->render_link($data, $values);
return $this->renderLink($data, $values);
}
}
......@@ -37,7 +37,7 @@ public function render($values) {
if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') {
$data = file_create_url($data);
}
return $this->render_link($data, $values);
return $this->renderLink($data, $values);
}
}
......@@ -93,7 +93,7 @@ public function render($values) {
'#theme' => 'mark',
'#status' => $mark,
);
return $this->render_link(drupal_render($build), $values);
return $this->renderLink(drupal_render($build), $values);
}
}
......
......@@ -42,7 +42,7 @@ public function render($values) {
$value = $this->getValue($values);
$language = language_load($value);
$value = $language ? $language->name : '';
return $this->render_link($value, $values);
return $this->renderLink($value, $values);
}
}
......@@ -34,7 +34,7 @@ public function buildOptionsForm(&$form, &$form_state) {
);
parent::buildOptionsForm($form, $form_state);
// The path is set by render_link function so don't allow to set it.
// The path is set by renderLink function so don't allow to set it.
$form['alter']['path'] = array('#access' => FALSE);
$form['alter']['external'] = array('#access' => FALSE);
}
......@@ -48,11 +48,11 @@ public function query() {
public function render($values) {
if ($entity = $this->getEntity($values)) {
return $this->render_link($entity, $values);
return $this->renderLink($entity, $values);
}
}
function render_link($node, ResultRow $values) {
protected function renderLink($node, ResultRow $values) {
if (node_access('view', $node)) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'node/' . $node->id();
......
......@@ -23,7 +23,7 @@ class LinkDelete extends Link {
/**
* Renders the link.
*/
function render_link($node, ResultRow $values) {
protected function renderLink($node, ResultRow $values) {
// Ensure user has access to delete this node.
if (!node_access('delete', $node)) {
return;
......
......@@ -23,7 +23,7 @@ class LinkEdit extends Link {
/**
* Renders the link.
*/
function render_link($node, ResultRow $values) {
protected function renderLink($node, ResultRow $values) {
// Ensure user has access to edit this node.
if (!node_access('update', $node)) {
return;
......
......@@ -64,7 +64,7 @@ public function buildOptionsForm(&$form, &$form_state) {
*
* Data should be made XSS safe prior to calling this function.
*/
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_node']) && !empty($this->additional_fields['nid'])) {
if ($data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
......@@ -89,7 +89,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -60,7 +60,7 @@ public function buildOptionsForm(&$form, &$form_state) {
*
* Data should be made XSS safe prior to calling this function.
*/
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_node_revision']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$nid = $this->getValue($values, 'nid');
......@@ -75,7 +75,7 @@ function render_link($data, ResultRow $values) {
}
}
else {
return parent::render_link($data, $values);
return parent::renderLink($data, $values);
}
return $data;
}
......
......@@ -35,7 +35,7 @@ public function access() {
return user_access('view revisions') || user_access('administer nodes');
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
list($node, $vid) = $this->get_revision_entity($values, 'view');
if (!isset($vid)) {
return;
......
......@@ -24,7 +24,7 @@ public function access() {
return user_access('delete revisions') || user_access('administer nodes');
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
list($node, $vid) = $this->get_revision_entity($values, 'delete');
if (!isset($vid)) {
return;
......
......@@ -24,7 +24,7 @@ public function access() {
return user_access('revert revisions') || user_access('administer nodes');
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
list($node, $vid) = $this->get_revision_entity($values, 'update');
if (!isset($vid)) {
return;
......
......@@ -53,7 +53,7 @@ function render_name($data, $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->render_name($value, $values), $values);
return $this->renderLink($this->render_name($value, $values), $values);
}
}
......@@ -24,7 +24,7 @@ public function render($values) {
$language = language_load($value);
$value = $language ? $language->name : '';
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -69,7 +69,7 @@ public function buildOptionsForm(&$form, &$form_state) {
*
* Data should be made XSS safe prior to calling this function.
*/
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$tid = $this->getValue($values, 'tid');
if (!empty($this->options['link_to_taxonomy']) && !empty($tid) && $data !== NULL && $data !== '') {
$term = entity_create('taxonomy_term', array(
......@@ -90,7 +90,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -19,7 +19,7 @@
*/
class Language extends User {
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$uid = $this->getValue($values, 'uid');
if (!empty($this->options['link_to_user'])) {
$uid = $this->getValue($values, 'uid');
......@@ -41,7 +41,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
......@@ -61,7 +61,7 @@ public function query() {
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
*/
public function render($values) {
return $this->render_link($this->getEntity($values), $values);
return $this->renderLink($this->getEntity($values), $values);
}
/**
......@@ -74,7 +74,7 @@ public function render($values) {
* @return string
* The acutal rendered text (without the link) of this field.
*/
public function render_link(EntityInterface $entity, ResultRow $values) {
protected function renderLink(EntityInterface $entity, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('View');
$this->options['alter']['make_link'] = TRUE;
......
......@@ -21,9 +21,9 @@
class LinkCancel extends Link {
/**
* Overrides \Drupal\user\Plugin\views\field\Link::render_link().
* {@inheritdoc}
*/
public function render_link(EntityInterface $entity, ResultRow $values) {
protected function renderLink(EntityInterface $entity, ResultRow $values) {
if ($entity && $entity->access('delete')) {
$this->options['alter']['make_link'] = TRUE;
......
......@@ -21,9 +21,9 @@
class LinkEdit extends Link {
/**
* Overrides \Drupal\user\Plugin\views\field\Link::render_link().
* {@inheritdoc}
*/
public function render_link(EntityInterface $entity, ResultRow $values) {
protected function renderLink(EntityInterface $entity, ResultRow $values) {
if ($entity && $entity->access('update')) {
$this->options['alter']['make_link'] = TRUE;
......
......@@ -40,8 +40,8 @@ public function buildOptionsForm(&$form, &$form_state) {
);
}
function render_link($data, ResultRow $values) {
parent::render_link($data, $values);
protected function renderLink($data, ResultRow $values) {
parent::renderLink($data, $values);
if ($this->options['link_to_user'] == 'mailto') {
$this->options['alter']['make_link'] = TRUE;
......
......@@ -75,7 +75,7 @@ public function buildOptionsForm(&$form, &$form_state) {
);
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
$account = entity_create('user', array());
$account->uid = $this->getValue($values, 'uid');
$account->name = $this->getValue($values);
......
......@@ -52,7 +52,7 @@ public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
}
function render_link($data, ResultRow $values) {
protected function renderLink($data, ResultRow $values) {
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();
......@@ -63,7 +63,7 @@ function render_link($data, ResultRow $values) {
public function render($values) {
$value = $this->getValue($values);
return $this->render_link($this->sanitizeValue($value), $values);
return $this->renderLink($this->sanitizeValue($value), $values);
}
}
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