You are here

function template_preprocess_asset_widget_edit_buttons in Asset 7

Preprocess variables for asset-widget-edit-buttons.tpl.php.

See also

asset-widget-edit-buttons.tpl.php

File

modules/asset_widget/theme/theme.inc, line 49
Module related preprocesses and theme overrides.

Code

function template_preprocess_asset_widget_edit_buttons(&$vars) {
  if (!empty($vars['asset'])) {
    $vars['preview_link'] = l('<span class="ico"></span>' . t('Preview'), "javascript: void(0)", array(
      'html' => TRUE,
      // To leave raw href.
      'external' => TRUE,
    ));

    // Note, we allowing edition only if creation allowed because if not - there is no tab in widget for it.
    if (asset_creation_access($vars['asset']->type) && asset_edition_access($vars['asset']->type)) {
      $vars['edit_link'] = l('<span class="ico"></span>' . t('Edit'), "admin/content/assets/manage/{$vars['asset']->aid}", array(
        'html' => TRUE,
        'attributes' => array(
          'id' => 'aid-' . $vars['asset']->type . '-' . $vars['asset']->aid,
          'target' => '_blank',
          'class' => 'asset-widget-modify-asset',
        ),
      ));
    }
  }
}