View more context

 

dorsetdigital

FWIW, I have projects with hundreds of thousands of records in DataObjects

stephanus

Does gridfield performance get much slower when handling thousand of dataobjects?

One of my projects has a couple of hundreds SiteTree and the admin just completely freezes Firefox and Chrome 😂

dorsetdigital

They do grind a bit sometimes when you're running queries

Lee

@null - Sorry, I meant tabs within a page i.e. those created with $fields->addFieldsToTab( ... )

MichalKleiner

we have a custom helper, something along these lines…

  1. /**
  2.   * Reorder tabs in the content section of the CMS, with the ability to change their titles
  3.   *
  4.   * @param FieldList $fields
  5.   * @param array $tabsOrder
  6.   * @param string $topTabName
  7.   * @return FieldList
  8.   */
  9. public static function reorderCmsTabs(FieldList &$fields, array $tabsOrder, string $topTabName = 'Root'): FieldList
  10. {
  11. foreach ($fields as $field) {
  12. if (($field instanceof TabSet) && ($field->getName() === $topTabName)) {
  13. $tabs = $field->Tabs();
  14.  
  15. foreach (array_reverse($tabsOrder) as $tabName => $tabTitle) {
  16. if (is_numeric($tabName)) {
  17. $tabName = $tabTitle;
  18. }
  19. /** @var Tab $tabToMove */
  20. if ($tabToMove = $tabs->fieldByName($tabName)) {
  21. $fields->removeByName($tabName);
  22. if (($tabTitle !== $tabName) && ($tabTitle !== $tabToMove->Title())) {
  23. $tabToMove->setTitle($tabTitle);
  24. }
  25. $tabs->unshift($tabToMove);
  26. }
  27. }
  28.  
  29. $field->setTabs($tabs);
  30. }
  31. }
  32.  
  33. return $fields;
  34. }
MichalKleiner

so it technically removes them and puts them back in a desired order

MichalKleiner

and you can pass it an array like ['Main', 'RelatedDocuments', 'RelatedPages' => 'Related articles', ]