inherit
265712
0
Jul 29, 2022 4:44:01 GMT -8
CST1229
5
January 2022
cst1229
|
Post by CST1229 on Feb 23, 2022 22:50:40 GMT -8
Is there a way to get the number of posts per page in a plugin?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Feb 24, 2022 4:35:03 GMT -8
Update: pb.data('lm_limit') now gives you that value without having to dive into list manager's bowelsIs there a way to get the number of posts per page in a plugin? That number is buried in the prototype of the list manager which can be accessed via window.listMan (test for it since not consistently present on every page) or via proboards.listManagers[pb.data('lm_id')] (more consistent for the time being). Once you have access to the list manager you can then query its prototype for its options: window.listMan.options.limitSince access to the proboards global namespace has been deprecated and we've been told to access user-facing functions through the newer pb namespace (i.e. pb.list_manager()) we'll lose access to the list manager prototype at some point and no longer have that data to rely upon in our coding so you may want to weigh that calculation if including such a feature in your code.
|
|
inherit
265712
0
Jul 29, 2022 4:44:01 GMT -8
CST1229
5
January 2022
cst1229
|
Post by CST1229 on Feb 24, 2022 7:38:44 GMT -8
Is there a way to get the number of posts per page in a plugin? That number is buried in the prototype of the list manager which can be accessed via window.listMan (test for it since not consistently present on every page) or via proboards.listManagers[pb.data('lm_id')] (more consistent for the time being). Once you have access to the list manager you can then query its prototype for its options: window.listMan.options.limitSince access to the proboards global namespace has been deprecated and we've been told to access user-facing functions through the newer pb namespace (i.e. pb.list_manager()) we'll lose access to the list manager prototype at some point and no longer have that data to rely upon in our coding so you may want to weigh that calculation if including such a feature in your code. Thanks! Is using the proboards global object as a fallback like this fine? const listMan = window.listMan || proboards.listManagers[pb.data('lm_id')];
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Feb 24, 2022 8:01:15 GMT -8
That should work!
|
|