Enable/disable button-card

Hi there!
how can i enable/disable the lock option of a button-card using the state of a certain sensor?

This is my code

Thanks in advance

Use this:

If you have issues or questions post them in that topic.

Thanks tom for the answer. I have this card that i want to lock/unlock based on the state of an input_boolean entity.

                  - card:
                      entity: switch.sprinkler_relay_1
                    row: true
                    type: 'custom:restriction-card'
                    restrictions:
                      block: true
                    condition:
                      value: 'on'
                      entity: group.sprinkler_running_status

i found this example:

                entities:
                  - card:
                      entity: switch.sprinkler_relay_1
                    row: true
                    type: 'custom:restriction-card'
                    restrictions:
                      block: true
                    condition:
                      value: 'on'
                      entity: group.sprinkler_running_status

but i cannot match both codes. Any idea?