We are using Fieldable Panels Panes to create fieldable entities for use in panels. While we are primarily placing these panes in panel pages, it would be useful to be able to also occasionally place them outside of panels without having to use the Bean module, which would duplicate configuration and data (see: #1860118: Comparison with the Bean module).

I've created a patch that adds a checkbox to expose select FPPs as blocks for use outside of panels. Please note that this patch adds a new database column, so update.php must be run after applying it.

Files: 
CommentFileSizeAuthor
#10 fieldable_panels_panes-render_as_block-1910934-10.patch3.04 KBChris Burge
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#6 fieldable_panels_panes-render_as_block-1910934-6.patch1.58 KBthrnio
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#3 fieldable_panels_panes-render_as_block-1910934-3.patch1.18 KBjlapp
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#1 fieldable_panels_panes-render_as_block-1910934-1.patch3.94 KBjlapp
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Comments

jlapp’s picture

Status:Active» Needs review
StatusFileSize
new3.94 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Attaching patch.

Dave Reid’s picture

Wondering why we can't just re-use the existing "Make this entity reusable" field? That would make sense to me. I want this item to be able to be placed in Panels and/or Blocks.

jlapp’s picture

StatusFileSize
new1.18 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Dave, thanks for the quick feedback. We certainly could do that. I was thinking you might have wanted to keep them separate, but simply reusing the existing field makes the patch much smaller and removes the need for a schema change. I'm attaching an updated patch that works as you described. Please let me know if you have any other feedback or suggestions!

asanchez75’s picture

asanchez75’s picture

Issue summary:View changes

Update issue description to reflect latest patch implementation

thrnio’s picture

Issue summary:View changes
Status:Needs review» Needs work

The patch in #3 adds a dependency to Entity.

thrnio’s picture

Status:Needs work» Needs review
StatusFileSize
new1.58 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Here's a quick-and-dirty updated patch to #3 that just adds a dependency for Entity. Should probably evaluate whether this really warrants adding Entity as a dependency.

Pere Orga’s picture

I disagree with #2 about reusing the "Make this entity reusable" field. You may want to have many reusable panes without having to create lots of blocks. That is the current behaviour.

IMO It makes sense to keep that as a separate field like in patch #1. If it is not accepted the functionality could be moved to another contrib module (and in that case, reusing that checkbox like in patch #7 could be ok).

DamienMcKenna’s picture

Status:Needs review» Needs work

I think it'd be useful to keep this simple and allow all "reusable" panes are available as blocks. However, there needs to be a global setting to enable this, because I wouldn't want a site to suddenly have hundreds or thousands of records flooding the block system.

Pere Orga’s picture

That sounds good to me

Chris Burge’s picture

Status:Needs work» Needs review
StatusFileSize
new3.04 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Attached is the patch from #6 modified as follows and rolled against latest dev:

  1. Defined 'fieldable_panels_panes_expose_as_blocks' variable to store global setting requested by #8
  2. Created 'Settings' page at admin/structure/fieldable-panels-panes/settings
  3. Modified 'fieldable_panels_panes_block_info' function to check if 'fieldable_panels_panes_expose_as_blocks' var is TRUE before making fieldable entity panes available as blocks
  4. Modified 'fieldable_panels_panes_block_view' function to check if 'fieldable_panels_panes_expose_as_blocks' var is TRUE before printing fieldable entity panes as blocks
  5. Modified 'fieldable_panels_panes_block_view' function to check if specified entity is reusable before printing entity
    (It's possible an entity could be added to a region as a block and later have its reusable status changed to FALSE.)
MiroslavBanov’s picture

The dependency to entity is because these functions are used:

entity_view()
entity_load_single()
entity_label()

But they can easily be replaced with these instead:

fieldable_panels_panes_view()
fieldable_panels_panes_load()
fieldable_panels_panes_entity_label_callback()