I have configured a field like this: enter image description here

When I create a Node, the field shows like this:

enter image description here

How can I, programmatically, start this field with two elements and not have to click on the "Add pet" button? For example:

enter image description here

  • 1
    Don't know if there is a solution in UI. In code you can do this in a hook_node_create, see drupal.stackexchange.com/questions/259275/…
    – 4k4
    Oct 10 '18 at 7:19
  • @4k4 thanks, it works for nodes, i needed this solution for a block too, but hook_block_create() didn't call, do you know why? I check my module name, clear cache, but didn't call it. I try with hook_entity_create() and works.
    – rpayanm
    Oct 10 '18 at 13:40
  • 1
    The entity type for custom blocks is block_content, so hook_block_content_create() should work.
    – 4k4
    Oct 10 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.