Displaying a Block in edit mode

Permalink
I have a form that I want to display a block in edit mode on. I can display a blocktype in add mode but I cannot display the block or blocktype in edit mode.

$bt = BlockType::getByHandle('video_player');
$bt->render('add');

Displays fine.


$bt = BlockType::getByHandle('video_player');
$bt->render('edit');

Errors out with:
'Call to a member function getBlockID() on a non-object'
'<a name="_edit<?php echo $b->getBlockID()?>"></a>'

I know I am missing something.

 
mnakalay replied on at Permalink Reply
mnakalay
To render a block in edit mode, it means a block instance already exists with a block ID and settings values.

What you have is a block type object so it's a generic one, not a specific one with a block ID so I don't think you can have it in edit mode. Edit mode means edit existing values but in your case there are no existing values.
PulseTDI replied on at Permalink Reply
I have tried but I cannot figure out how to display the edit view from the block and not the blocktype. The block itself with values does not have render so what do I use?
mnakalay replied on at Permalink Reply
mnakalay
The block itself doesn't have a render function but it has a display function with a view type as an argument just like render
PulseTDI replied on at Permalink Reply
When you use display it runs the following code try and build out the block form which errors out on $dialogController because it does not exist. I also do not need the block form at all.

<form method="post" id="ccm-block-form" class="validate" action="<?php echo $dialogController->action('submit')?>" enctype="multipart/form-data">
PulseTDI replied on at Permalink Reply
Any ideas?