You are here

function message_type_create in Message 7

Creates a new message type.

If a message type already exists, an exception will be thrown.

Return value

MessageType Returns a new message type object.

14 calls to message_type_create()
hook_default_message_type in ./message.api.php
Define default message type configurations.
MessageCron::testPurge in tests/message.test
Test purging of messages upon message_cron according to message type purge settings.
MessageCron::testPurgeGlobalSettings in tests/message.test
Test global purge settings and overriding them.
MessageCron::testPurgeRequestLimit in tests/message.test
Test compliance with MESSAGE_DELETE_PER_PURGE.
MessageCrud::testMessageCrud in tests/message.test
Test CRUD of message entity.

... See full list

File

./message.module, line 806
API functions to manipulate messages.

Code

function message_type_create($name, $values = array()) {
  global $language;

  // Make sure the message type doesn't already exist, to prevent duplicate key
  // error.
  if (message_type_load($name)) {
    throw new MessageException('Message type ' . check_plain($name) . ' already exists.');
  }
  $values['name'] = $name;
  $values += array(
    'language' => $language->language,
  );
  $return = entity_create('message_type', $values);
  return $return;
}