0

With Drupal (v7.22) I'm using the Entity Construction Kit (ECK) module (v7.x-2.0-rc2) and want to extend the sub module called 'ECK Example' that comes with it. Currently the example module just creates an Entity using code but doesn't include any default properties like Title, Author, Changed etc. This is the current module code:

$entity_type = new EntityType();
$entity_type->name = "eck_employee";
$entity_type->label = "Employee";
$entity_type->addProperty('name', 'Name', 'text');
$entity_type->save();

How can I enable the default properties for the Entity?

1

I've been researching and playing around with the ECK module all day and have managed to answer my own question. Hopefully someone else will find this helpful.

To the example code listed just add these lines before the save() function is called:

$entity_type->addProperty('title', 'Title', 'text', 'title');
$entity_type->addProperty('uid', 'Author', 'integer', 'author');
$entity_type->addProperty('created', 'Created', 'integer', 'created');
$entity_type->addProperty('changed', 'Changed', 'integer', 'changed');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.