public function getPermissionsActionPanel()
    {
        $fields = FieldList::create();
        $showFields = array(
            'CanViewType'  => '',
            'ViewerGroups' => 'hide',
            'CanEditType'  => '',
            'EditorGroups' => 'hide',
        );
        /** @var SiteTree $siteTree */
        $siteTree = singleton('SiteTree');
        $settingsFields = $siteTree->getSettingsFields();

        foreach ($showFields as $name => $extraCss) {
            $compositeName = "Root.Settings.$name";
            /** @var FormField $field */
            if ($field = $settingsFields->fieldByName($compositeName)) {
                $field->addExtraClass($extraCss);
                $title = str_replace('page', 'document', $field->Title());
                $field->setTitle($title);

                // Remove Inherited source option from DropdownField
                if ($field instanceof DropdownField) {
                    $options = $field->getSource();
                    unset($options['Inherit']);
                    $field->setSource($options);
                }
                $fields->push($field);
            }
        }

        $this->extend('updatePermissionsFields', $fields);

        return CompositeField::create($fields);
    }
public function getPermissionsActionPanel()
    {
        $fields = FieldList::create();
        $showFields = array(
            'CanViewType'  => '',
            'ViewerGroups' => 'hide',
            'CanEditType'  => '',
            'EditorGroups' => 'hide',
        );
        /** @var SiteTree $siteTree */
        $siteTree = singleton('SiteTree');
        $settingsFields = $siteTree->getSettingsFields();

        foreach ($showFields as $name => $extraCss) {
            $compositeName = "Root.Settings.$name";
            /** @var FormField $field */
            if ($field = $settingsFields->fieldByName($compositeName)) {
                $field->addExtraClass($extraCss);
                $title = str_replace('page', 'document', $field->Title());
                $field->setTitle($title);

                // Remove Inherited source option from DropdownField
                if ($field instanceof DropdownField) {
                    $options = $field->getSource();
                    unset($options['Inherit']);
                    $field->setSource($options);
                }
                $fields->push($field);
            }
        }

        $this->extend('updatePermissionsFields', $fields);

        return CompositeField::create($fields);
    }
public function getPermissionsActionPanel ( ) { $ fields = FieldList :: create ( ) ; $ showFields = array ( 'CanViewType' => '' , 'ViewerGroups' => 'hide' , 'CanEditType' => '' , 'EditorGroups' => 'hide' , ) ; /** @var SiteTree $siteTree */ $ siteTree = singleton ( 'SiteTree' ) ; $ settingsFields = $ siteTree -> getSettingsFields ( ) ; foreach ( $ showFields as $ name => $ extraCss ) { $ compositeName = "Root.Settings.$name" ; /** @var FormField $field */ if ( $ field = $ settingsFields -> fieldByName ( $ compositeName ) ) { $ field -> addExtraClass ( $ extraCss ) ; $ title = str_replace ( 'page' , 'document' , $ field -> Title ( ) ) ; $ field -> setTitle ( $ title ) ; // Remove Inherited source option from DropdownField if ( $ field instanceof DropdownField ) { $ options = $ field -> getSource ( ) ; unset ( $ options [ 'Inherit' ] ) ; $ field -> setSource ( $ options ) ; } $ fields -> push ( $ field ) ; } } $ this -> extend ( 'updatePermissionsFields' , $ fields ) ; return CompositeField :: create ( $ fields ) ; }
Adds permissions selection fields to a composite field and returns so it can be used in the "actions panel"

@return CompositeField
Adds permissions selection fields to a composite field and returns so it can be used in the actions panel