- ๐ณ๐ฑNetherlands Summit
Hi,
And needed for Drupal 6/7 to Drupal 10 Migration forward, and already broken in D7, D8 I think. Sorry not wanting to hiijack this issue, but clarifiing, and may be a solution is than possible for Drupal 10 back to Drupal 7: https://www.drupal.org/project/vbo_export/issues/3359435 ๐ View Result Counter is broken on exports that use batching Active
if of course it is the same issue. Otherwise, sorry to disturb this issue.
greetings, - last update
about 1 year ago 28,522 pass, 3 fail The same problem would not be feasible to be able to make a custom module that does that using patch 14 and 15 because it has been so long since there is still no news about this
- ๐ต๐ฑPoland sebaz
I've made my own counter. It is just a plugin to the Views module so copy the original one, inherit the original class and override methods shown in patches. Works a hell :)
- ๐ณ๐ฑNetherlands Summit
Hi SebaZ, willing to share your own counter? Thanks for your reply in advance,
Greetings, - ๐ต๐ฑPoland sebaz
Counter is written per project so I can't share it.
Just extend Counter class.
Remember that unique name of counter which is ViewField you have to set in annotation. You will need config schema also. - ๐ณ๐ฑNetherlands Summit
Hi Sebaz,
Thanks for the info. I am not a programmer, so are not able to build it.
But maybe it is great for someone to use it to build a add-on for views, or to add it to views.
Thanks!
greetings, - ๐ง๐ชBelgium mgstables
Thanks SebaZ it works perfectly.
For a taxonomy view, used as a filter menu, I needed an extra class โactiveโ for the first row.
I tried with the views counter and that didn't work.
Now with this "Counter fixed output" it works.
{% if counter_fixed == '1' %}active {% endif %}
Drupal 10.2.1
PHP 8.2 - ๐บ๐ธUnited States tory-w
The module in #37 works for me. Use case was building a view where I want every result that ends with "5", for example to have an attachment; say like an ad. I used this field to number each result, added a conditional field with the in-feed ad, and it works! It did not work with the core Global: View result counter.
Drupal 10.3.2
PHP 8.3.10 - ๐ฎ๐ณIndia prashant.c Dharamshala
prashant.c โ made their first commit to this issueโs fork.
- ๐ฎ๐ณIndia prashant.c Dharamshala
Is this issue still valid? Because now the value is being returned in the following way:
public function getValue(ResultRow $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; $pager = $this->view->pager; // Get the base count of the pager. if ($pager->usePager()) { $count += ($pager->getItemsPerPage() * $pager->getCurrentPage() + $pager->getOffset()); } // Add the counter for the current site. $count += $this->view->row_index + 1; return $count; }
- ๐ต๐ฑPoland sebaz
It never was issue about getting the value but how it is rendered.
Method
getValue()
vsrender()