Skip to content

How to set a filter to a fixed property value? #131

Answered by kszymukowicz
Moongazer asked this question in Q&A
Discussion options

You must be logged in to vote

There is nothing build in in t3api so far.
We do such things with enableColumns.

In below example only records that have public set to 1 are returned. There is additional condition that will return not public if those records belongs to current FE user. Good if you need to show current user his all records no matter they are public or not.

The same enable field can be reused in several TCA definitions if done well like below.

In TCA:

<?php
return [
    'ctrl' => [
.....
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
            'public' => [
                'column' => 'public',
                '…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Moongazer
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Moongazer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants