private function setupFields(News $owner, FieldList $fields)
    {
        // Remove all basic fields from parent, so we can setup as we wish.
        $fields->removeByName(array_keys($owner->db()));
        $fields->removeByName(array_keys($owner->has_one()));
        $fields->removeByName(array_keys($owner->has_many()));
        $fields->removeByName(array_keys($owner->many_many()));
        // For some reason, not all fields are removed from the has_one list. So I'll have to add "ID" to the strings.
        foreach ($owner->has_one() as $hasOne) {
            $fields->removeByName($hasOne . 'ID');
        }
        $fields->removeByName('Commenting');
        /** @var array $fieldset The array of fields that should be visible */
        $fieldset = $this->field_list;
        foreach ($fieldset as $key => $fieldlist) {
            ksort($fieldlist);
            $fields->addFieldsToTab($key, $fieldlist);
        }

        return $fields;
    }
private function setupFields(News $owner, FieldList $fields)
    {
        // Remove all basic fields from parent, so we can setup as we wish.
        $fields->removeByName(array_keys($owner->db()));
        $fields->removeByName(array_keys($owner->has_one()));
        $fields->removeByName(array_keys($owner->has_many()));
        $fields->removeByName(array_keys($owner->many_many()));
        // For some reason, not all fields are removed from the has_one list. So I'll have to add "ID" to the strings.
        foreach ($owner->has_one() as $hasOne) {
            $fields->removeByName($hasOne . 'ID');
        }
        $fields->removeByName('Commenting');
        /** @var array $fieldset The array of fields that should be visible */
        $fieldset = $this->field_list;
        foreach ($fieldset as $key => $fieldlist) {
            ksort($fieldlist);
            $fields->addFieldsToTab($key, $fieldlist);
        }

        return $fields;
    }
private function setupFields ( News $ owner , FieldList $ fields ) { // Remove all basic fields from parent, so we can setup as we wish. $ fields -> removeByName ( array_keys ( $ owner -> db ( ) ) ) ; $ fields -> removeByName ( array_keys ( $ owner -> has_one ( ) ) ) ; $ fields -> removeByName ( array_keys ( $ owner -> has_many ( ) ) ) ; $ fields -> removeByName ( array_keys ( $ owner -> many_many ( ) ) ) ; // For some reason, not all fields are removed from the has_one list. So I'll have to add "ID" to the strings. foreach ( $ owner -> has_one ( ) as $ hasOne ) { $ fields -> removeByName ( $ hasOne . 'ID' ) ; } $ fields -> removeByName ( 'Commenting' ) ; /** @var array $fieldset The array of fields that should be visible */ $ fieldset = $ this -> field_list ; foreach ( $ fieldset as $ key => $ fieldlist ) { ksort ( $ fieldlist ) ; $ fields -> addFieldsToTab ( $ key , $ fieldlist ) ; } return $ fields ; }
Setup the actual fieldlists and tabs.

@param News $owner
@param FieldList $fields

@return FieldList
Setup the actual fieldlists and tabs .