This is a great module.
All that is needed, at the given time is a little tweaking, to resolve the only 10 posts bug; a solution that can be found here
Also I noticed that when a custom pager is placed "In a sidebar block" and your website has block caching enable from Site configuration -> Performance the pager stops working correctly.
I found that by editing the custom_pager.module file around line 112, we can set the custom pager block to have no cache:
function custom_pagers_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$pagers = _custom_pagers_load_all_pagers();
foreach ($pagers as $pager) {
if ($pager->position == 'block') {
$blocks[$pager->pid]['info'] = $pager->title;
+ $blocks[$pager->pid]['cache'] = BLOCK_NO_CACHE;
}
}
return $blocks;
In order for this to work you need to change the existing customer pager to another option say "Above the node's body" and save, refresh the Site building ->Blocks page(so that the custom pager block no longer exists ), then change the "Pager position" again to sidebar block.
Now it should work.
Hopefully some of these features(?bugs?) will be added(resolved) in the future.
Comment | File | Size | Author |
---|---|---|---|
#8 | custom_pagers-block_caching-796782-8.patch | 4.46 KB | MikeActually |
Comments
Comment #1
OldAccount CreditAttribution: OldAccount commentedThanks, I was having a heck of a time trying to figure out what happened to my pager when it started acting strange (showing correct total number but not progressing past 3 out of 12, etc.) I tried this and it seems to have done the trick.
Comment #2
asb CreditAttribution: asb commentedIs this fixed in beta2?
Comment #3
akosipax CreditAttribution: akosipax commentedNo it isn't fixed in beta2...
Comment #4
doublejosh CreditAttribution: doublejosh commentedTried to solve this via Block Cache Alter but it is not respected and the pager is always the same for everyone node in the view. This updates to whatever I look at first after clearing the cache. Even setting the block to "Do Not Cache" rather than "Per page" does not solve the problem.
Comment #5
rooby CreditAttribution: rooby commentedThis is also a problem in the drupal 7 version.
I will make a patch soon to allow you to select a caching option per pager.
Just setting to BLOCK_NO_CACHE is not a great solution because then you lose all caching.
For example, for my use DRUPAL_CACHE_PER_PAGE is preferrable.
Comment #6
MikeActually CreditAttribution: MikeActually commentedI threw this patch together to help resolve this issue;
Maybe there's a module out there that can do per block cache definitions? If there is, I'm not aware of it.
This should allow you to select the type of caching on a per pager basis. It can probably use some work, but I think will help most people.
Comment #7
MikeActually CreditAttribution: MikeActually commentedComment #8
MikeActually CreditAttribution: MikeActually commentedUpdated patch; this is a bit better in that it doesn't make the drop-down a required field (silly oversight on my part) and also allows for a selection with no value.
Comment #9
rooby CreditAttribution: rooby commentedBeing able to configure caching would be a nice addition.
patch review:
I don't think we should have this. I think if we're fixing it with this patch just do it the preferred way now instead of adding a todo.
Trailing whitespace.
I think this should have a more specific name. Since we are specifically dealing with block caching it should say block caching instead of drupal caching. I think the database column should also reflect this and be block_cache or block_cache_granularity or something.
Instead of escaping your internal double quotes just use single quotes to wrap the string.
URLs should not go in t() because they will break if translated. See https://api.drupal.org/api/drupal/includes!common.inc/function/t/6 for the prefered way to put URLs in translated strings.
There is no need top use t() for an empty string. It's also not a good idea to use t() for the option key because translations could give you inconsistent values.
For these options it's possible it would be better to use human readable text for the array values instead of the constants. Although I can see the value in having them match the API docs, site admins aren't necessarily technical people and probably don't want to go and read an API page.
If you are going to use the constant values to match the API then don't use t() because you don't want translations making it so the values don't match the API docs.
Also in this case I don't think it is necessary to have (drupal default) for the role option, it would be better to just remove the empty option and have the role option as the default, seeing as that is what will happen if no caching type is set.
If a user was to select the empty string and Drupal one day changes the default value the functionality of the user's website will change unexpectedly so I think it's better to force a value.
Also, it is best to keep using single quotes for consistency and only use double quotes if your string contains single quotes or you want to put variables in the string (which you wouldn't want with t()).
This description needs changing. If you want to mention what the default value is you can also add it here to the description instead of as part of the option text itself.
Again I think it would be better to specify block cache for naming and describing this.
missing the second asterisk on the first line.
In this specific case (update functions) it is best not to use "Implements hook_update_N()" because the comment text of the function gets displayed to the user when they run the update. So it should just describe what the update is doing.
There should be an empty line (with leading asterisk) between the first line (short description) and any additional longer description. This won't affect the description being shown to the user that I just mentioned because that has new lines stripped out.
You should not use 7000 as the number. 7000 is generally reserved for updates specific to upgrading from a 6.x version to a 7.x version.
7100, 7200, etc. are generally reserved for updates specific to upgrading between 7.x-1.x and 7.x-2.x etc., so I would recommend using 7101 for this update.
You shouldn't call a hook_schema implementation from an update function because in future the schema that hook_schema() returms may have changed, which then changes what your update function is doing but updates that update functions perform should remain the same forever. So it is best to hard code the field array here even though it is code that is currently duplicated in hook_schema(). It could save broken updates in future.
For this section you should be able to do something like this: