elementTypeFromString static method

MBElementType elementTypeFromString(
  1. String string
)

Returns the MBElementType from its String representation.

  • Parameters:
    • string: the string representation of the element type.

Implementation

static MBElementType elementTypeFromString(String string) {
  switch (string.toLowerCase()) {
    case 'text':
    case 'textarea':
      return MBElementType.text;
    case 'image':
      return MBElementType.images;
    case 'audio':
    case 'video':
    case 'document':
    case 'file':
    case 'media':
      return MBElementType.media;
    case 'checkbox':
      return MBElementType.checkbox;
    case 'datetime':
      return MBElementType.date;
    case 'address':
      return MBElementType.address;
    case 'dropdown':
      return MBElementType.dropdown;
    case 'poll':
      return MBElementType.poll;
    case 'markdown':
      return MBElementType.markdown;
    case 'relation':
      return MBElementType.relation;
    case 'color':
      return MBElementType.color;
    case 'shopify_collection':
      return MBElementType.shopifyCollection;
    case 'custom':
      return MBElementType.custom;
    default:
      return MBElementType.undefined;
  }
}