Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

FileSize
3.14 KB

Ooops, too many white spaces.

tim.plunkett’s picture

Status: Needs review » Needs work
+++ b/handlers/views_handler_field.incundefined
@@ -395,6 +395,9 @@ class views_handler_field extends views_handler {
+        'substr' => array('default' => FALSE),

Needs 'bool' => TRUE

pcambra’s picture

Status: Needs work » Needs review
FileSize
3.16 KB

Fixed

pcambra’s picture

Fixed

dawehner’s picture

Status: Needs review » Needs work

In general this patch looks fine!

+++ b/handlers/views_handler_field.incundefined
@@ -395,6 +395,9 @@ class views_handler_field extends views_handler {
+        'substr_start' => array('default' => ''),

What about using 0 as default value, so it is a bit clearer what to input here.

+++ b/handlers/views_handler_field.incundefined
@@ -1154,6 +1184,15 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
+    if (!empty($this->options['alter']['substr'])) {
+      if ($alter['substr_length'] === '') {
+        $value = substr($value, $alter['substr_start']);
+      }
+      else {
+        $value = substr($value, $alter['substr_start'], $alter['substr_length']);
+      }

Why not use drupal_substr here

pcambra’s picture

Status: Needs work » Needs review
FileSize
2.73 KB

I've implemented the suggested changes and changed a little the description as substr is not called directly anymore.
Rerolled to last 7.x dev

devad’s picture

Issue summary: View changes

This issue is old and this functionality is never committed... maybe it is considered too specific to be included into main views module.

Is it possible for it to become new tiny views contrib module maybe?

And D8 version would be nice as well. :)

Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch in #6 to views_handler_field.inc does not apply to the latest views 7.x-3.x-dev.

Checking patch handlers/views_handler_field.inc...
error: while searching for:
        'target' => array('default' => '', 'translatable' => TRUE),
        'nl2br' => array('default' => FALSE, 'bool' => TRUE),
        'max_length' => array('default' => ''),
        'word_boundary' => array('default' => TRUE, 'bool' => TRUE),
        'ellipsis' => array('default' => TRUE, 'bool' => TRUE),
        'more_link' => array('default' => FALSE, 'bool' => TRUE),

error: patch failed: handlers/views_handler_field.inc:413
error: handlers/views_handler_field.inc: patch does not apply
Andrew Answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
2.71 KB

Patch rerolled.