src/GridFieldOrderableRows.php
protected function getSortValuesFromManyManyThroughList($list, $sortField)
    {
        $manipulator = $this->getManyManyInspector($list);

        // Find the foreign key name, ID and class to look up
        $joinClass = $manipulator->getJoinClass();
        $fromRelationName = $manipulator->getForeignKey();
        $toRelationName = $manipulator->getLocalKey();

        // Create a list of the MMTL relations
        $sortlist = DataList::create($joinClass)->filter([
            $toRelationName => $list->column('ID'),
            // first() is safe as there are earlier checks to ensure our list to sort is valid
            $fromRelationName => $list->first()->getJoin()->$fromRelationName,
        ]);

        return $sortlist->map($toRelationName, $sortField)->toArray();
    }
protected function getSortValuesFromManyManyThroughList($list, $sortField)
    {
        $manipulator = $this->getManyManyInspector($list);

        // Find the foreign key name, ID and class to look up
        $joinClass = $manipulator->getJoinClass();
        $fromRelationName = $manipulator->getForeignKey();
        $toRelationName = $manipulator->getLocalKey();

        // Create a list of the MMTL relations
        $sortlist = DataList::create($joinClass)->filter([
            $toRelationName => $list->column('ID'),
            // first() is safe as there are earlier checks to ensure our list to sort is valid
            $fromRelationName => $list->first()->getJoin()->$fromRelationName,
        ]);

        return $sortlist->map($toRelationName, $sortField)->toArray();
    }
protected function getSortValuesFromManyManyThroughList ( $ list , $ sortField ) { $ manipulator = $ this -> getManyManyInspector ( $ list ) ; // Find the foreign key name, ID and class to look up $ joinClass = $ manipulator -> getJoinClass ( ) ; $ fromRelationName = $ manipulator -> getForeignKey ( ) ; $ toRelationName = $ manipulator -> getLocalKey ( ) ; // Create a list of the MMTL relations $ sortlist = DataList :: create ( $ joinClass ) -> filter ( [ $ toRelationName => $ list -> column ( 'ID' ) , // first() is safe as there are earlier checks to ensure our list to sort is valid $ fromRelationName => $ list -> first ( ) -> getJoin ( ) -> $ fromRelationName , ] ) ; return $ sortlist -> map ( $ toRelationName , $ sortField ) -> toArray ( ) ; }
Used to get sort orders from a many many through list relationship record, rather than the current
record itself.

@param ManyManyList|ManyManyThroughList $list
@return int[] Sort orders for the
Used to get sort orders from a many many through list relationship record rather than the current record itself .