src/Controller/PluginViewController.php
public function orderInterfaceChildren($parentKey, $childrenInterface)
    {
        $melisAppConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        $orderInterface = $melisAppConfig->getOrderInterfaceConfig($parentKey);

        if (empty($orderInterface)) {
            // No order defined, items are displayed directly like found in interface config
            // meaning order is made uppon config merge
            return $childrenInterface;
        } else {
            $resultOrdered = [];

            // We first reorder depending on order defined
            foreach ($orderInterface as $orderKey) {
                if (is_array($orderKey)) {
                    $resultOrdered = $orderInterface;
                    break;
                }
                if (!empty($childrenInterface[$orderKey])) {
                    $resultOrdered[$orderKey] = $childrenInterface[$orderKey];
                    unset($childrenInterface[$orderKey]);
                }
            }

            // We add items at the end that are in the config but not present in the custom order
            foreach ($childrenInterface as $keyInterface => $childinterface) {
                $resultOrdered[$keyInterface] = $childinterface;
            }

            return $resultOrdered;
        }

    }
public function orderInterfaceChildren($parentKey, $childrenInterface)
    {
        $melisAppConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        $orderInterface = $melisAppConfig->getOrderInterfaceConfig($parentKey);

        if (empty($orderInterface)) {
            // No order defined, items are displayed directly like found in interface config
            // meaning order is made uppon config merge
            return $childrenInterface;
        } else {
            $resultOrdered = [];

            // We first reorder depending on order defined
            foreach ($orderInterface as $orderKey) {
                if (is_array($orderKey)) {
                    $resultOrdered = $orderInterface;
                    break;
                }
                if (!empty($childrenInterface[$orderKey])) {
                    $resultOrdered[$orderKey] = $childrenInterface[$orderKey];
                    unset($childrenInterface[$orderKey]);
                }
            }

            // We add items at the end that are in the config but not present in the custom order
            foreach ($childrenInterface as $keyInterface => $childinterface) {
                $resultOrdered[$keyInterface] = $childinterface;
            }

            return $resultOrdered;
        }

    }
public function orderInterfaceChildren ( $ parentKey , $ childrenInterface ) { $ melisAppConfig = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreConfig' ) ; $ orderInterface = $ melisAppConfig -> getOrderInterfaceConfig ( $ parentKey ) ; if ( empty ( $ orderInterface ) ) { // No order defined, items are displayed directly like found in interface config // meaning order is made uppon config merge return $ childrenInterface ; } else { $ resultOrdered = [ ] ; // We first reorder depending on order defined foreach ( $ orderInterface as $ orderKey ) { if ( is_array ( $ orderKey ) ) { $ resultOrdered = $ orderInterface ; break ; } if ( ! empty ( $ childrenInterface [ $ orderKey ] ) ) { $ resultOrdered [ $ orderKey ] = $ childrenInterface [ $ orderKey ] ; unset ( $ childrenInterface [ $ orderKey ] ) ; } } // We add items at the end that are in the config but not present in the custom order foreach ( $ childrenInterface as $ keyInterface => $ childinterface ) { $ resultOrdered [ $ keyInterface ] = $ childinterface ; } return $ resultOrdered ; } }
This function takes the list of children and reorders them by comparing
the order list available in MelisModuleConfig.

@param string $parentKey
@param array $childrenInterface

@return array
This function takes the list of children and reorders them by comparing the order list available in MelisModuleConfig .