fnagel / generic-gallery

TYPO3 extension: Generic Gallery - One gallery to rule them all!
https://extensions.typo3.org/extension/generic_gallery/
GNU General Public License v3.0
7 stars 12 forks source link

Enable sortby in TCA #6

Closed froemken closed 7 years ago

froemken commented 7 years ago

Hi Felix,

thank you for this extension. In table pictures you have created the column sorting already, but it was not used in your extension. Can you please add it to the ctrl section of TCA and add default sorting in repository?

Thank you

Frömmi

yeezy69 commented 7 years ago

Hey Frömmi, hey Felix.

I had same problem and change some source for my installation. Here my solution (i think it is for typo3 >=6.2). Felix, I hope, you will include this in your official source :+1:

File typo3conf/ext/generic_gallery/Classes/Domain/Repository/GalleryItemRepository.php Add a Variable in class GalleryItemRepository

// Order by BE sorting
protected $defaultOrderings = array(
  'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
);

File typo3conf/ext/generic_gallery/Configuration/TCA/tx_generic_gallery_pictures.php

Add in 'ctrl' => array(

    'sortby' => 'sorting',

)

Add in columns => array(

    'sorting' => array(
        'config' => array(
            'type' => 'passthrough',
        ),
    ),

)

Now delete typo3temp directory and cache :-)

screenshot_001

fnagel commented 7 years ago

Thanks a lot for your contribution. This will be included in the next release as I have no idea as it isn't a feature yet :-D

Seems the columns configuration is no longer needed for TYPO3 7.x.

yeezy69 commented 7 years ago

as i remember: in my columns array i had to insert sorting array on typo3 7.6.15, but i'm not 100% sure :)

fnagel commented 7 years ago

Mhh, tested this with 7.6.14 and it worked without adding column configuration.