You are here

function asset_widget_drop_get_label in Asset 7

Menu callback to build label for dropped asset.

1 string reference to 'asset_widget_drop_get_label'
asset_widget_menu in modules/asset_widget/asset_widget.module
Implements hook_menu().

File

modules/asset_widget/asset_widget.admin.inc, line 70
Assets widget administration pages logic.

Code

function asset_widget_drop_get_label() {
  $response = array(
    '#type' => 'ajax',
  );
  $output = '';
  if (isset($_POST['aid']) && ($aid = $_POST['aid']) && ($asset = asset_load($aid))) {
    $label = entity_label('node', $asset);
    $output = "{$label} ({$aid})";
  }
  $response['#commands'][] = array(
    'command' => 'assetWidgetDropToField',
    'data' => array(
      'label' => $output,
      'selector' => $_POST['selector_id'] ? $_POST['selector_id'] : '',
    ),
  );
  return $response;
}