Muszę dołączyć pole do niektórych pakietów. Fragment PHP wykona za mnie zadanie, więc nie potrzebuję modułu. Poniżej fragment, który należy wykonać:
$field_name = 'field_custom_image';
// Create the field.
$field = array(
'field_name' => $field_name,
'type' => 'image',
);
field_create_field($field);
a następnie fragment, aby dodać to pole do pakietu:
// Create the instance.
$instance = array(
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => 'article',
'label' => 'Image',
'description' => 'An image for the article.',
'required' => TRUE,
);
field_create_instance($instance);
Czy istnieje sposób na uruchomienie kodu PHP bezpośrednio w Drupal, bez potrzeby pisania modułu, instalowania go, uruchamiania i deinstalowania?