Last active
December 20, 2015 18:19
-
-
Save bastianallgeier/6175390 to your computer and use it in GitHub Desktop.
This is some fancy new stuff coming in Kirby 2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Page modification API | |
// modifying pages | |
$page = page('portfolio/project-a'); | |
$page->title = 'A wonderful project'; | |
$page->text = 'This project is just an example…'; | |
$page->year = '2013'; | |
$page->likes = 0; | |
$page->likes->increment(); | |
$page->likes->decrement(); | |
$page->save(); | |
// deleting pages | |
$page->delete(); | |
// sorting pages | |
$page->sort('first'); | |
$page->sort('last'); | |
$page->sort(5); | |
$page->sort('up'); | |
$page->sort('down'); | |
// make pages visible/invisible | |
$page->make('visible'); | |
$page->make('invisible'); | |
$page->toggle(); | |
// moving pages | |
$page->move('totally/different/parent/page'); | |
// change the page's template | |
$page->changeTemplate('mytemplate'); | |
# File modification API | |
// modifying file meta data | |
$file = page('portfolio/project-a')->images()->find('picture.jpg'); | |
$file->title = 'This is a wonderful picture'; | |
$file->caption = 'A fancy filter is missing though'; | |
// deleting files | |
$file->delete(); | |
// renaming files | |
$file->rename('super-picture'); |
This is super. Can't wait!
Insane you can get it that simple. Cannot wait to get my hands on it!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! Really looking forward to this.