Cockpit - the next iteration šŸ„

And how would you call a singleton in the new version?

I have tried:

  • $primary_menu = Cockpit::instance()->module(ā€˜Frontpageā€™)->find(ā€˜primary_menuā€™);
  • $frontpage = Cockpit::instance()->module(ā€˜Frontpageā€™);

@tokant If Frontpage itā€™s the singleton, Have you try this :

$frontpage = Cockpit::instance()->module(ā€˜contentā€™)->find(ā€˜frontpageā€™, ['filter' => ['_state' => 1]]);
$primary_menu = Cockpit::instance()->module(ā€˜contentā€™)->item('primary_menu');
$frontpage = Cockpit::instance()->module(ā€˜contentā€™)->item('Frontpage');

1 Like

Is it still possible to get a specific locale?

In previous version, we could add this option [ā€˜langā€™ => $locale]

Something like this:
Cockpit::instance()->module(ā€˜contentā€™)->items(ā€˜dictionaryā€™, [ā€˜langā€™ => $locale])

Thanks

Yes:

Cockpit::instance()->module(ā€˜contentā€™)->items('dictionary', [], ['locale' => $locale]);
1 Like

Thanks for the answer and all your work. New version looks really nice.

1 Like