public function manipulateTreePrickerForSortOrder(ManipulateWidgetEvent $event)
    {
        $widget = $event->getWidget();
        if (!($widget instanceof TreePicker)) {
            return;
        }

        $options = (array) $widget->options;
        if (0 === \count($options)) {
            return;
        }

        $model = $event->getModel();
        if (!($model instanceof Model)) {
            return;
        }

        $attribute = $model->getItem()->getAttribute($widget->strField);
        if (!($attribute instanceof AbstractTags)) {
            return;
        }

        $widget->orderField = $widget->orderField . '__ordered';

        $ordered = \array_flip(\array_merge([], (array) $model->getProperty($widget->strField)));
        foreach ($options as $option) {
            $ordered[$option['value']] = $option['value'];
        }

        $widget->{$widget->orderField} = $ordered;
    }
public function manipulateTreePrickerForSortOrder(ManipulateWidgetEvent $event)
    {
        $widget = $event->getWidget();
        if (!($widget instanceof TreePicker)) {
            return;
        }

        $options = (array) $widget->options;
        if (0 === \count($options)) {
            return;
        }

        $model = $event->getModel();
        if (!($model instanceof Model)) {
            return;
        }

        $attribute = $model->getItem()->getAttribute($widget->strField);
        if (!($attribute instanceof AbstractTags)) {
            return;
        }

        $widget->orderField = $widget->orderField . '__ordered';

        $ordered = \array_flip(\array_merge([], (array) $model->getProperty($widget->strField)));
        foreach ($options as $option) {
            $ordered[$option['value']] = $option['value'];
        }

        $widget->{$widget->orderField} = $ordered;
    }
public function manipulateTreePrickerForSortOrder ( ManipulateWidgetEvent $ event ) { $ widget = $ event -> getWidget ( ) ; if ( ! ( $ widget instanceof TreePicker ) ) { return ; } $ options = ( array ) $ widget -> options ; if ( 0 === \ count ( $ options ) ) { return ; } $ model = $ event -> getModel ( ) ; if ( ! ( $ model instanceof Model ) ) { return ; } $ attribute = $ model -> getItem ( ) -> getAttribute ( $ widget -> strField ) ; if ( ! ( $ attribute instanceof AbstractTags ) ) { return ; } $ widget -> orderField = $ widget -> orderField . '__ordered' ; $ ordered = \ array_flip ( \ array_merge ( [ ] , ( array ) $ model -> getProperty ( $ widget -> strField ) ) ) ; foreach ( $ options as $ option ) { $ ordered [ $ option [ 'value' ] ] = $ option [ 'value' ] ; } $ widget -> { $ widget -> orderField } = $ ordered ; }
Manipulate the tree picker for sort order.

@param ManipulateWidgetEvent $event The event.

@return void
Manipulate the tree picker for sort order .