http://i.imgur.com/YdiGmSO.png

So here are two issues:

  1. How to add placeholder into the text input?
  2. How to remove label of the text input ("E-mail")?

I suppose it can be solved with drupal hooks, but how exactly?

Comments

dev18.addweb’s picture

Yes, it can be done in two ways:

1. Using drupal hook in custom module

function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'SIMPLENEWS_FORM_ID') {
    $form['mail']['#title'] = '';
    $form['mail']['#attributes']['placeholder'] = t('PLACEHOLDER TEXT');
  }
}

2. Use Form Placeholder module.

Let me know incase of any query/concern for the same.

Thanks!

SkyFlame’s picture

I get a mistake:
Fatal error: Cannot redeclare simplenews_form_alter() (previously declared in /home/sky5672/html/sites/all/modules/simplenews/simplenews.module:749) in /home/sky5672/html/sites/all/themes/softstorage/template.php on line 100

So I have to create a custom module even for changing these two little things?

VM’s picture

As there is no configuration for what you seek, yes you would either create a module or use one provided for you.

SkyFlame’s picture

I've added to template.php in my theme's function these code:

if ($form_id == 'simplenews_block_form_165') {
 $form['mail']['#title'] = '';
 $form['mail']['#attributes']['placeholder'] = t('Введите ваш e-mail...');
}

165 is a number of the block in my case.

So thanks for help!