title: Overwrite Form Control in Drupal 7 Forms API
body: <p>I have three form controls in my page: fieldset, item type and a managed file.</p>
  
  <pre><code>function myid_user_page_form(){  
      $form = array();
      $form['id'] = array(
          '#type' =&gt; 'fieldset',
          '#title' =&gt; t('ID Information'),
          '#collapsible' =&gt; TRUE, 
          '#collapsed' =&gt; FALSE,
      );
      $form['id']['mymarkup'] = array(
          '#type' =&gt; 'item',
          '#markup' =&gt; 
              '&lt;canvas id="cnv" name="cnv" width="500" height="100" style="border: 1px solid black;"&gt;&lt;/canvas&gt;'
      );  
      $form['id']['custom_content_block_image'] = array(
          '#type' =&gt; 'managed_file',
          '#name' =&gt; 'custom_content_block_image',    
          '#size' =&gt; 40,      
          '#upload_location' =&gt; 'public://',
          '#theme' =&gt; 'myid_signature_upload',
      ); 
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/veKS0.jpg" alt="enter image description here"></p>
  
  <p>When I click the "Choose File" button and upload image, it will look like this:</p>
  
  <p><img src="https://i.stack.imgur.com/rwSKA.jpg" alt="enter image description here"></p>
  
  <p>I want to display the image on the first form control location/ canvas location. How will I do that?</p>
  
  <p>These are my codes:</p>
  
  <pre><code>/**
    * Implements myid_signature_upload theme callback.
    */
  
  function theme_myid_signature_upload($variables) {    
      $element = $variables['element'];
      $output = '';  
      if($element['fid']['#value'] != 0) {    
          $output .= '&lt;div class="multifield-thumbnail"&gt;';
          $output .= theme('image_style', array('style_name' =&gt; 'thumbnail',                   'path' =&gt; file_load($element['fid']['#value'])-&gt;uri, 'getsize' =&gt; FALSE));
          $output .= drupal_render_children($element);
          $output .= '&lt;/div&gt;';
      }
      return $output;  
  }
  function myid_theme(){
      return array(    
          'myid_signature_upload' =&gt; array(
              'render element' =&gt; 'element',     
          ),
      ); 
  }
  </code></pre>