jeudi 24 août 2017

best way to deal with drupal custom field language when using services

Drupal custom field structure accepts the values as a language field object that contains and array of the actual field and when using drupal as a backend for example and the typescript as a front end, the language field structure will make a real challenge to set/get the values from the object which you must send to drupal. for example drupal accepts the node object this way :

{
  title: "my title",
  type: "article",
  field_myfield:
  {
    und:
    [
      {
        value: "test value",
        format: "filtered_html" 
      }
    ]        
  }
}

so the language field "und" will be changed to match the language key that you need to create the node for.

The question is: What is the best OOP design pattern to dynamically change the language key, setting, getting the field values and support for multi values fields?

Aucun commentaire:

Enregistrer un commentaire