# Conditionals on Block Attributes

**URL:** https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800
**Category:** Pinegrow WP
**Tags:** feature-request, blocks
**Created:** [March 20, 2024, 12:44pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800 "2024-03-20T12:44:49Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [March 20, 2024, 12:44pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/1 "2024-03-20T12:44:49Z")

</div>

Hi!

Would it be possible to add conditional logic to the block attributes?

So for example i have 2 block attributes. Block Attribute 1 and Block Attribute 2.

I want to show Block Attribute 2 if Block Attribute 1 is not empty or if Block Attribute 1 has a certain value/text.

Would that be easy to implement? That would be really powerful and make it a lot cleaner if i have a lot of attributes.

@matjaz @TechAkayy

Thanks  
Guido

---

<div class="post-metadata">

### Author: ![krievinshj](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@krievinshj](https://forum.pinegrow.com/u/krievinshj)
#### Post date: [March 20, 2024, 3:05pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/2 "2024-03-20T15:05:35Z")

</div>

I am new to Pinegrow and was wondering about the exact same question.

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [April 2, 2024, 5:53pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/3 "2024-04-02T17:53:19Z")

</div>

Hi @matjaz

Just wanted to follow up on this plus an add-on question 😉

I just noticed that i can only add 12 attributes to a block. Can this number be increased or is this an limitation on Gutenberg Blocks and the amount of attributes they hold?

Thanks  
Guido

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [April 12, 2024, 11:31pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/4 "2024-04-12T23:31:38Z")

</div>

Another follow up @matjaz 🙂

Any insight into this?

Thanks  
Guido

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [April 15, 2024, 8:03am UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/5 "2024-04-15T08:03:08Z")

</div>

> [@Guido](#):
>
> I just noticed that i can only add 12 attributes to a block. Can this number be increased or is this an limitation on Gutenberg Blocks and the amount of attributes they hold?

This is just a PG limit. I increased it to 24 now. There is some performance hit if there are many fields, so don’t want to go too high for this.

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [April 15, 2024, 9:38am UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/6 "2024-04-15T09:38:40Z")

</div>

Hi @matjaz

Oke great! Don’t think i will ever need to go above 24. But super helpful that i can add more then 12 in the next release.

Could you also please respond to my initial question about the conditionals on block attributes? That is something i really hope that is possible. Especially if i ever have to go to 24 attributes then showing them conditionally would be awesome! 😉

Thanks @matjaz

Guido

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [April 15, 2024, 12:36pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/7 "2024-04-15T12:36:12Z")

</div>

> [@Guido](#):
>
> Could you also please respond to my initial question about the conditionals on block attributes?

Yes, conditionals would be great. Not just based on attribute values, but also on user roles / capabilities. That would let us make certain attributes editable only to specified users. I’m thinking about how to implement this in an elegant way.

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [April 15, 2024, 1:06pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/8 "2024-04-15T13:06:49Z")

</div>

@matjaz AWESOME!! That is really good news! 😉 Cant wait to play around with that. 😃

Guido

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [April 17, 2024, 2:04pm UTC](https://forum.pinegrow.com/t/conditionals-on-block-attributes/8800/9 "2024-04-17T14:04:42Z")

</div>

Hi @matjaz

I just received this update from metabox: [MB Blocks Update: Register Block Using block.json File - Meta Box](https://metabox.io/mb-blocks-register-block-using-json-file/)

Is this something that Pinegrow is already doing while registering blocks? Just thought i would share it with you since it might make it easier to register settings and attributes? Or might make it easier to have more attributes/have conditionals?

Guido
