Open theGC opened 4 years ago
Also worth adjusting renderTestSelector
to allow for the new start modifier:
// take into account a limit=n
if(strpos($selector, 'limit=') !== false && preg_match('/\blimit=(\d+)/', $selector, $matches)) {
$out = ' ' . sprintf($this->_('(%d without limit)'), $cnt);
// take into account a start=n
if(strpos($selector, 'start=') !== false && preg_match('/\bstart=(\d+)/', $selector, $startMatches)) {
$cnt -= $startMatches[1];
if($cnt < 0) $cnt = 0;
}
if($cnt > $matches[1]) $cnt = $matches[1];
}
@theGC This one was intentionally left out since it's the current pagination number ($input->pageNum
) that determines and sets the start=
value. The primary public API usage of it is so that you can specify start=0
to override automatic pagination for things like top level navigation that doesn't change on paginations. I wasn't aware there was a use case for having 'start' in this module. Can you describe more about the use case?
yeah sure, we're using it to allow clients to select pages (categories or products), showing a limited set of these, starting at a certain index.
The above is set up within a matrix repeater, I've screengrabbed a sample set up below:
The above allows the user to create blocks of content, with the same selector broken up over 2 or more parts of the page.
Short description of the issue
start
is not available as a modifier within InputFieldSelectorExpected behavior
start
to be availableActual behavior
it isn't
Optional: Screenshots/Links that demonstrate the issue
Optional: Suggestion for a possible fix
Add
start
modifier to line 588 of wire/modules/Inputfield/InputfieldSelector/InputfieldSelector.modulehttps://github.com/theGC/processwire/blob/48092d503e90720df796adb0a5f8bfd3afd84889/wire/modules/Inputfield/InputfieldSelector/InputfieldSelector.module#L588
Steps to reproduce the issue
install processwire, add a selector field to a page
Setup/Environment
any