[development] Override 'Size of textfield'

Muzaffer Tolga Ozses tolga at ozses.net
Sun Feb 22 17:38:10 UTC 2015


Hi,

I wrote a module, which utilises field_create_field and
field_create_instance. I have my $instance array like below:

$instance = array(
    'field_name' => 'field_tckn',
    'entity_type' => 'user',
    'bundle' => 'user',
    'label' => t('TCKN'),
    'description' => t('Enter your TCKN.'),
    'settings' => array(
      'user_register_form' => TRUE,
    ),
    'display' => array(
      'default' => array(
        'label' => 'above',
        'type' => 'text_textfield',
        'settings' => array(
          'size' => 11,
        ),
      ),
      'full' => array(
        'label' => 'above',
        'type' => 'text_textfield',
        'settings' => array(
          'size' => array(
            '#default_value' => 11,
          ),
        ),
      ),
    ),
    'widget' => array(
      'settings' => array(
        'size' => 11,
        'description' => t('Enter your TCKN.'),
      ),
    ),
  );

The field is attaches to user bundle just fine, but what I would like to is
re-use the field in any content type. I can do that too, but I would like
to override 'Size of textfield' when I add the field. What am I missing in
the above code?

Regards,

-- 
mto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20150222/13783166/attachment.html 


More information about the development mailing list