Skip to content

Instantly share code, notes, and snippets.

@scottrigby
Created August 20, 2014 14:45
Show Gist options
  • Save scottrigby/a8aa0186d2465b22702a to your computer and use it in GitHub Desktop.
Save scottrigby/a8aa0186d2465b22702a to your computer and use it in GitHub Desktop.
Example restws_schema_map variable

The restws_schema module requires a developer to set a restws_schema_map variable, which maps their custom schema to Drupal entities, bundles, and their properties or fields.

This should correspond to the schema defined by the restws_schema variable, and can optionally be created using the UI provided by the included restws_schema_ui module.

See restws_schema_map_get() for documentation on how this variable should be structured.

Here is an example value:

array(
  'show:entity' => 'node',
  'show:bundle' => 'page',
  'show:name' => 'title',
  'show:id' => 'nid',
  'show:description' => 'body',
  'show:genre' => 'field_genre',
  'show:seasons' => 'field_seasons',
  'show:status' => 'status',
  'season:entity' => 'node',
  'season:bundle' => 'season',
  'season:name' => 'title',
  'season:id' => 'nid',
  'season:description' => 'body',
  'season:show' => 'field_show',
  'season:episodes' => 'field_episodes',
  'season:status' => 'status',
  'episode:entity' => 'node',
  'episode:bundle' => 'episode',
  'episode:name' => 'title',
  'episode:id' => 'nid',
  'episode:description' => 'body',
  'episode:show' => 'field_show',
  'episode:season' => 'field_season',
  'episode:status' => 'status',
  'blog:entity' => 'node',
  'blog:bundle' => 'article',
  'blog:name' => 'title',
  'blog:id' => 'nid',
  'blog:description' => 'body',
  'blog:show' => 'field_show',
  'blog:season' => 'field_season',
  'blog:episode' => 'field_episode',
  'blog:status' => 'status',
  'gallery:entity' => 'node',
  'gallery:bundle' => 'gallery',
  'gallery:name' => 'title',
  'gallery:id' => 'nid',
  'gallery:description' => 'body',
  'gallery:photos' => 'field_photos',
  'gallery:show' => 'field_show',
  'gallery:season' => 'field_season',
  'gallery:episode' => 'field_episode',
  'gallery:status' => 'status',
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment