일부 번들에 필드를 첨부해야합니다. PHP 스 니펫이 나를 위해 일할 것이므로 모듈이 필요하지 않습니다. 아래 스 니펫은 실행 해야하는 것입니다.
$field_name = 'field_custom_image';
// Create the field.
$field = array(
'field_name' => $field_name,
'type' => 'image',
);
field_create_field($field);
그런 다음이 코드를 번들에 추가하는 스 니펫 :
// 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);
모듈을 작성, 설치, 실행 및 제거 할 필요없이 Drupal에서 PHP 코드를 직접 실행할 수있는 방법이 있습니까?