0

デフォルトでは、エンティティ登録モジュールは登録を無効にします。「登録の管理 - 設定」タブからノードが作成されるたびに有効にする必要があります。プロセスを自動化するには?

registration.field.inc の registration_field_info() で「status」の値を「1」に変更しようとしましたが、うまくいきませんでした。

そうでなければ、プログラムでそれを行う方法はありますか?

4

1 に答える 1

1
/**
* Implements hook_entity_insert().
*/
function registration_entity_insert($entity, $entity_type) {
  $registration_type = registration_get_entity_registration_type($entity_type, $entity);
  if ($registration_type !== FALSE) {
list($entity_id) = entity_extract_ids($entity_type, $entity);

$settings2 = array(
  'multiple_registrations' => 0,
  'from address' => variable_get('site_mail', ini_get('sendmail_from')),
);

$settings = array(
  'status' => 1,
  'capacity' => 0,
  'send_reminder' => 0,
  'settings' => serialize($settings2),
);

registration_update_entity_settings($entity_type, $entity_id, $settings);
//registration_entity_set_default_settings($entity_type, $entity);
 }
}

参考文献:

http://drupal.org/node/1430870

http://drupal.org/node/1357280

于 2013-04-25T01:17:34.530 に答える