Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`page.update:after` hook seems to work with a cached the collection #1401

Closed
texnixe opened this issue Jan 24, 2019 · 1 comment

Comments

@texnixe
Copy link
Contributor

commented Jan 24, 2019

Probably similar to this old bug: #747
Describe the bug
When trying to sort the siblings collection by date after updating a date, the new date is not picked up. The page itself does pick up the new date, though.

Here is a short example to illustrate the issue:

<?php

Kirby::plugin('texnixe/examplehook', [
    'hooks' => [
	    'page.update:after' => function ($page) {
		$dates = $page->siblings()->listed()->pluck('date');
		
			try {
			$page->parent()->update([
			'date'  => json_encode($page->date()),
			'alldates'    => json_encode($dates)
				
			]);
			} catch(Exception $e) {

			throw new Exception( $e->getMessage());
			
			}
    	}
   	]
]);

This will update the parent page with the new date in the date field, while the alldates field will not store the new date.

See this post in the forum: https://forum.getkirby.com/t/porting-panel-page-update-hook-to-kirby-3-syntax/12431/4

@texnixe texnixe changed the title `page.update:after` hook seems to store the collection `page.update:after` hook seems to cache the collection Jan 24, 2019
@texnixe texnixe changed the title `page.update:after` hook seems to cache the collection `page.update:after` hook seems to work with a cached the collection Jan 24, 2019
@bastianallgeier bastianallgeier added this to the 3.0.3 milestone Feb 18, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.0.3, 3.1.0 Feb 25, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.1.0, 3.1.1 Mar 11, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.1.2, 3.1.3 Apr 2, 2019
@bastianallgeier bastianallgeier removed this from the 3.1.3 milestone Apr 12, 2019
@distantnative distantnative added this to the 3.2.2 milestone Apr 16, 2019
@bastianallgeier bastianallgeier modified the milestones: 3.2.2, 3.2.3 Jul 10, 2019
@distantnative distantnative removed this from the 3.2.3 milestone Jul 18, 2019
@distantnative distantnative self-assigned this Sep 15, 2019
@distantnative distantnative added this to the 3.2.5 milestone Sep 15, 2019
distantnative added a commit that referenced this issue Sep 15, 2019
distantnative added a commit that referenced this issue Sep 15, 2019
bastianallgeier added a commit that referenced this issue Sep 16, 2019
@bastianallgeier

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.