This project is not covered by Drupal’s security advisory policy.

The object module seeks to truly objectify core entities to make them easier to work with in a programmatic way. It is essentially an object wrapper around the procedural code in core.

Examples

Load and change the title of an existing node 1.

$node = new drupalNode();
$node->load(1);
$node->title = 'Test Title';
$node->save();

Load user 212 and change the username.

$user = new drupalUser(212);
$user->name = 'new username';
$user->save();

Load a user by username, set a message if they have a permission, set a field value, change the password and save the user.

$account = new drupalUser();
$account->loadByName('myusername');
if ($account->access('access awesome message') {
  drupal_set_message('This message is awesome');
}
$account->setField('field_option', 'blue', 0, 'value');
$account->pass = 'New Password';
$account->save();

Create a new page node, set the title, set some fields and save.

$node = new drupalNode('page');
$node->title = 'Test Title';
$node->setField('field_option', 'blue', 0, 'value');
$node->setField('body', 'This is the body text', 0, 'value');
$node->save();

Project information

Releases