Stack in a Automated Job

Permalink 2 users found helpful
So the job is running (Type AbstractJob), so far so good....

Now, the jobs job is to send some emails to some users.
The problem is, when I try to load a Stack into the job:
Calling
$text = Stack::getByName('mitgliedschaft_laeuft_bald_ab')
is fine, gives me the stack object, but calling the
$myhtmlString = $text->display()
method on that object gives me the following error:
Call to a member function getAreaCustomStyle() on a non-object


Edit:
I give the block in the stack a block name (handle)
under Admin -> Blocks & Stacks -> Edit Modus (on a block in the stack) -> Advanced
then I call it like so:
$block = Block::getByName('block_name');
$block->display('scrapbook');
// But because the display-method is void I can't do this:
$var = $block->display('scrapbook');

I had a look into Page/Area/Block/Collection/... classes, but no luck.

How can I put a Stack's block type "Content" into a variable as string?

daenu
 
daenu replied on at Permalink Best Answer Reply
daenu
Here comes the solution.
As said in the "Edit" Part: Give the Block in the stack a name (handle).
$block = Block::getByName('block_name');

Then call the controlle and get the content:
$ctrl = $block->getController();
$var = $ctrl->getBlockControllerData()->content;