In Drupal 7 I created an entity programmatically. It has a few textfields added like name, price etc in the form:
$form['data']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => isset($model->data['name']) ? $model->data['name']: '',
'#maxlength' => 255,
'#required' => TRUE,
'#weight' => -3,
);
However, I'd like to be able to add multiple images to every entity it as well.
When I use Drupal's user interface to add fields, I can pick "Image: field_image (Image)" at the bottom, under "Add an existing field". This field has exactly the behaviour I want.
How can I add it programmatically to my entity?