You are here

function theme_assetfield in Asset 5.2

Same name and namespace in other branches
  1. 6 asset_wizard.module \theme_assetfield()

Format an assetfield.

Parameters

$element: An associative array containing the properties of the element. Properties used: title, value, description, size, maxlength, required, attributes autocomplete_path

Return value

A themed HTML string representing the assetfield.

Related topics

File

./asset_wizard.module, line 163
Wizard-style interface for Asset.

Code

function theme_assetfield($element) {
  $class = array(
    'form-asset',
  );
  $output = '';
  _form_set_class($element, $class);
  if ($element['#value']) {
    $asset = asset_load($element['#value']);
    $preview = '<span class="icon">' . asset_icon($asset, 64) . '</span>';
    $title = $asset->title;
  }
  else {
    $preview = '<span class="icon">' . theme('image', drupal_get_path('module', 'asset_Wizard') . '/icons/missing.png', NULL, NULL, array(
      'width' => 64,
    ), FALSE) . '</span>';
    $title = '';
  }
  $output .= '<div class="assetfield-icon">' . theme('asset_wizard_textarea_link', $element, $preview) . '</div>';
  $output .= '<div class="assetfield-detail">';
  $output .= '<div class="assetfield-title">' . $title . '</div>';
  $output .= '<input type="text" maxlength="10" size="10" name="' . $element['#name'] . '" id="' . $element['#id'] . '" value="' . check_plain($element['#value']) . '"' . drupal_attributes($element['#attributes']) . ' />';
  $output .= '</div>';
  $output = '<div class="assetfield-container clear-block">' . $output . '</div>';
  return theme('form_element', $element, $output);
}