Name.js 839 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. var entryFactory = require('../../../../factory/EntryFactory');
  3. /**
  4. * Create an entry to modify the name of an an element.
  5. *
  6. * @param {djs.model.Base} element
  7. * @param {Object} options
  8. * @param {string} options.id the id of the entry
  9. * @param {string} options.label the label of the entry
  10. *
  11. * @return {Array<Object>} return an array containing
  12. * the entry to modify the name
  13. */
  14. module.exports = function(element, options, translate) {
  15. options = options || {};
  16. var id = options.id || 'name',
  17. label = options.label || translate('Name'),
  18. modelProperty = options.modelProperty || 'name';
  19. var nameEntry = entryFactory.textBox({
  20. id: id,
  21. label: label,
  22. modelProperty: modelProperty,
  23. get: options.get,
  24. set: options.set
  25. });
  26. return [ nameEntry ];
  27. };