Is there a alternative for autoID plugin?

about moving from autoid to uuids:

and there is a thread in discord on how to create custom uuid for structures. BUT no solution for duplicating entries!

code is based on work done by @pedroborges

site/plugins/structuuid/index.php

<?php

use Kirby\Cms\App as Kirby;

/*
 myStructure:
    type: structure
    fields:
      uniqueId:
        type: structure-uuid
 */

Kirby::plugin('bnomei/unique-ids-for-structures', [
    'fields' => [
        'structure-uuid' => [
            'computed' => [
                'value' => function () {
                    return $this->value ?? uuid();
                },
            ],
        ],
    ],
]);

site/plugins/structuuid/index.js

panel.plugin('bnomei/unique-ids-for-structures', {
  fields: {
    'structure-uuid': {
      template: '<template></template>',
      mounted() {
this.$el.parentElement.parentElement.remove()
      },
    }
  }
});
1 Like