code: public function getValuesForMenuItemsCounters(): array {
          $counters = [];
          /** @var ScaffoldConfigInterface $scaffoldConfigClass */
          foreach ($this->getResources() as $scaffoldConfigClass) {
              $counterClosure = $scaffoldConfigClass::getMenuItemCounterValue();
              if (!empty($counterClosure)) {
                  $counters[$scaffoldConfigClass::getMenuItemCounterName()] = value($counterClosure);
              }
          }
          return $counters;
      }
docs: Get values for menu items counters (details in CmfConfig::menu())
  @return array like ['pending_orders' => '<span class="label label-primary pull-right">2</span>']