Comments (2)
The bug with disappearing pages in the panel when having numeric slugs is now fixed. But I would like to note that one should be careful with using slugs starting with numbers in kirby 2 in the first place. You might run into unexpected behavior in some cases (Wrong folder name if new page starts with a number).
The other problem is not something I am able to fix properly. Actually the reason why the modules are stored in the parent .txt file is to keep the order for visible and invisible subpages in the panel and I did never rely on the stored order in the frontend.
If you rely on the stored order and need to make sure that the subpages are always in sync with the field then you would need to implement a hook on your own to do so.
Sadly there is no generic way of doing this. Something like the following might get you going:
kirby()->hook('panel.page.move', function ($page, $oldPage) {
// the used field name
$field = 'modules';
// when you are using the sortable (modules) field in conjunction
// with the modules-plugin it is relatively easy to determine
// weather the moved page is a module or not
// if ($page->isModule()) {
//
// }
//
// otherwise you need to somehow make sure that the moved page
// is a module with something along this lines perhaps:
// if (
// $page->intendedTemplate() === 'subTemplate' &&
// $page->parent()->intendedTemplate() === 'parentTemplate'
// ) {
//
// }
if ($page->isModule()) {
$parent = $page->parent();
// when using the parent option
if (!$parent->{$field}()->exists()) {
$parent = $parent->parent();
}
$values = $parent->{$field}()->split(',');
$index = array_search($oldPage->uid(), $values);
$values[$index] = $page->uid();
$parent->update([
$field => implode(', ', $values),
]);
}
});
from kirby-sortable.
Problem with slug is solved in patch 2.4.1. Thanks!
from kirby-sortable.
Related Issues (20)
- Inline editing of modules HOT 1
- Make readme more clear
- Multilang titles in module overview HOT 3
- Drag axis HOT 3
- Easier way of disabling default actions HOT 6
- Disable field when readonly is set to true in the blueprint HOT 1
- Error 500 on update if status:false in child's blueprint HOT 2
- Long module titles break the layout HOT 1
- Copy Page / recursively endless spinn HOT 3
- Skipping modal (hacky solution) HOT 3
- Error on pasting modules using the Modules field HOT 1
- Add page title for new entries HOT 1
- Role based actions in layouts HOT 2
- Drag and Drop not working in IE 11 HOT 2
- Disable sorting based on roles HOT 5
- Hide page in module section HOT 8
- Error: mb_strpos(): Empty delimiter HOT 8
- in the add modal are modules and page templates shown mixed HOT 1
- PHP 7.4.x and Kirby 2.5.13 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby-sortable.