I'm building a custom field which is display only, it takes data from another field rather than storing any itself.

as part of this, I want to display some information in an appropriate field within the widget, my element in 'hook_widget' therefore looks like:

      $element['data_source_message'] = array(
        '#title'        =>  t('Data display source'),
        '#type'         => "item",
        '#markup'       => "<p>".t('Using the fieldname as the source for the displayed data.')."</p>",
        '#description'  => "<p>".t('Some description about something')."</p>",
      );

everything renders fine, except for the '#markup' element. not sure if this is a bug or if I've missed a trick somewhere.

thoughts anyone?

Comments

karens’s picture

Status: Active » Closed (won't fix)

This has nothing to do with CCK as far as I can see. You are trying to add something to a form array that Form API knows nothing about. There is no such thing as '#markup'.

markchitty’s picture

hi karen,

thanks for getting back to me. It seems I was getting ahead of myself looking at this:

http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....

rather than this:

http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....

my bad!