Change name of sender field to allow better theming

zetxek - April 28, 2009 - 15:36
Project:ecard
Version:6.x-1.6
Component:Code
Category:feature request
Priority:normal
Assigned:zetxek
Status:closed
Description

The markup that Drupal Forms API was inserting for my "sender name" field was casusing some troubles, as it was named as the login form "user name".
I changed the field name in the form array, renaming "name" to "sender_name" in lines 254, 412, 432, 444.

I could make a patch, but I don't know why it marks all my code as new...

#1

Eric_A - July 21, 2009 - 08:53

This would break existing ecard_form alters on ['name']/ [block[0]['name']. I vote for a different solution. Could you clarify the issue with the markup a little more?

EDIT: fixed error in fieldname. BTW: it would not just break existing alters but any manipulation that involves this field, for example custom validation and submit handlers that depend on this form field.

#2

Pixelstyle - August 19, 2009 - 07:30

Eric, I think zetxek only wants to use different translation strings, not variable names. My php skills are meager at best, but this wouldn't be a problem, would it:

Line 252:

<?php
 
//senders name
 
$form['name'] = array(
   
'#title' => t('Your name'),
   
'#type' => 'textfield',
   
'#required' => variable_get('ecard_require_name', 0)
  );
 
//sending from
 
$form['from_email'] = array(
   
'#title' => t('Your email'),
   
'#type' => 'textfield',
   
'#required' => TRUE
 
);
?>

Change to:

<?php
 
//senders name
 
$form['name'] = array(
   
'#title' => t('Sender name'),
   
'#type' => 'textfield',
   
'#required' => variable_get('ecard_require_name', 0)
  );
 
//sending from
 
$form['from_email'] = array(
   
'#title' => t('Sender email'),
   
'#type' => 'textfield',
   
'#required' => TRUE
 
);
?>

#3

Kars-T - November 12, 2009 - 14:41
Status:needs review» fixed

#447422 by Pixelstyle: Added Change name of sender field to allow better theming.

Changed in all versions.

#4

System Message - November 26, 2009 - 14:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.