API call to create and populate accordion

Permalink Browser Info Environment
Hi,

Thank you very much for releasing this block for free!

I am trying to create and populate one item in the accordion, using C5.7's API.

As an example, this works for the simple (built-in) "content" block:
$block = \BlockType::getByHandle('content');
$data = array( 'content' => $attributes['rawhtml'], );
$page->addBlock($block, 'Main', $data);


So, for your block I have tried:
$block = \BlockType::getByHandle('vivid_simple_accordion');
$data = array(
    'title' => array('One title'),
    'description' => array('Its description'),
    'state' => array('closed'),
);
$page->addBlock($block, 'Main', $data);

and the block gets created but no items in it. When viewed on page it says:
"You did not add any items to the accordion."

Could you please let me know what is the correct form of the $data for this to work?

Thanks a lot,

Lian

Type: Pre-Sale
Status: In Progress
csebe
View Replies:
csebe replied on at Permalink Reply
csebe
Hi again,

no worries, I got it.

Thanks,
Lian

concrete5 Environment Information

Concrete 5.7.4.1

Browser User-Agent String

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.