title: How can I get the title of a form element in Drupal?
body: <p>For example, in the registration form, there is "Username" and the text field for it which has the input type="text" name="name" ....</p>
  
  <p>I need to know how can I get the title from the input field's name.</p>
  
  <p>I'm expecting a function like:</p>
  
  <pre><code>$title = get_title_for_element('name');
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>assert($title == 'Username'); // is true
  </code></pre>
  
  <p>Is there something like this in Drupal?</p>
  
  <p>Thanks.</p>