Naming Blocks Via Code

Permalink
I'm making a plugin for a client where we get itinerary data from a 3rd party site using a API. Pages are generated with content inside of norm content blocks. When we want to update a page using the API we want to get all the blocks and then update them base on the new data from the API. Is there a way to give content blocks names or would I have to change the content block to allow adding names? Tried to get all blocks from a page using getBlocks() on the page object but can't find any bID to load the blocks as well.

In the GUI we can name blocks but there does not appear to be any documentation on doing this through code. We are setting a custom php file that contains the html generated code to be sent to view but cannot find a way to set a name on blocks.

Does anyone know how we might achieve this? Is it hidden or protected maybe?

TooqInc
 
TooqInc replied on at Permalink Reply
TooqInc
For further clarification, We are setting a custom php file that contains the html generated code to be sent to view but cannot find a way to set a name on blocks.

We are creating pages using blocks and stacks. These blocks may need to be updated using the API in the future and need to see if there is a way to get the correct block for the data we are updating.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi TooqInc,

Have you tried the setName() method?
http://documentation.concrete5.org/api/8.3.2/Concrete/Core/Block/Bl...
TooqInc replied on at Permalink Reply
TooqInc
That is likely it. Will have a look later today.

Thank you!