By jcisio on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
7.x-1.x
Introduced in version:
7.x-1.1
Description:
JSON request at atom/fetch/CONTEXT/SIDs has been changed to atom/fetch/SIDs?context=CONTEXT (the context is optional) now returns meta data. The returned data structure has been thus modified:
In Scald 1.0:
array(
'3' => array(
'full' => 'rendered atom in full context',
),
'5' => array(
'full' => 'rendered atom in full context',
),
);
In Scald 1.1:
array(
'3' => array(
'contexts' => array(
'full' => 'rendered atom in full context',
),
'actions' => array(
'fetch',
'view',
),
'meta' => array(
'title' => 'Atom title',
'type' => 'type machine name',
'legend' => '',
),
),
'5' => array(
'contexts' => array(
'full' => 'rendered atom in full context',
),
'actions' => array(
'fetch',
'view',
'edit',
'delete',
),
'meta' => array(
'title' => 'Atom title',
'type' => 'type machine name',
'legend' => '',
),
),
);
To check whether the user can edit atom SID=5:
Drupal.dnd.fetchAtom('', 5, function() {
if ($.grep(Drupal.dnd.Atoms[5].actions, function(e){ return e == 'edit'; }).length > 0) {
alert('Can edit');
}
else {
alert('Can not edit');
}
});
Impacts:
Module developers