... is this possible?

I need to put subtitles on static position which have to be displayed in create and display mode.
Can I use the markup module??

Kind regards

Kai

CommentFileSizeAuthor
#8 patch.markup.547276.patch1.52 KBchrisschaub

Comments

herzbube’s picture

+1 for having the markup appear in display mode! Currently it only appears in create/edit/preview mode.

tstackhouse’s picture

Subscribing. This would be a welcome improvement.

tstackhouse’s picture

This would need some more work to potentially add in things like a checkbox to toggle display (is it even necessary? one could just get away with using the option under display fields), but add this block of code into markup.module and presto markup fields will be available for display on the view of your nodes.

/**
 * Implementation of hook_field()
 */
function markup_field($op, &$node, $field, &$items, $teaser, $page) {
  switch ($op) {
    case 'load':
      return array(
        $field['field_name'] => array(
          array('markup' => $field['markup']),
        ),
      );
  }
}

/**
 * Implementation of hook_theme()
 */
function markup_theme() {
  return array(
    'markup_formatter_default' => array(
      'arguments' => array('element' => NULL),
    ),
  );
}


/**
* Implementation of hook_field_formatter_info()
*/
function markup_field_formatter_info() {
  return array(
    'default' => array(
      'label' => t('Default'),
      'field types' => array('markup'),
      'multiple values' => CONTENT_HANDLE_CORE,
    ),
  );
}

/**
* Theme function for 'default' markup field formatter
*/
function theme_markup_formatter_default($element) {
  return $element['#item']['markup'];
}
tstackhouse’s picture

Status: Active » Needs review

Changing status.

makt’s picture

I tried to add the code from #3 to markup.module but I received an error.

"Fatal error: Cannot redeclare markup_theme() (previously declared in /markup.module:145) in /markup.module on line 379"

Currently using Markup 6.x-1.0-beta1 and Drupal 6.22. Any suggestions? I need to have static text display on the form section and the display section.

MBroberg’s picture

Works for me if I remove the php tags.

A checkbox for
1-show in form mode
2-show in view mode
would be nice, but I do appreciate the fact that I can hide it from view in the display fields.

MBroberg’s picture

Strangely though, it only works if the display format is something other than "default." Any idea why that would be?

chrisschaub’s picture

Component: Miscellaneous » Code
StatusFileSize
new1.52 KB

Here's a patch based on #3 against the lastest 6.x-dev.

Road Kill’s picture

I would be really fantastic to see this feature in D7

firfin’s picture

@ road kill : looks like thereis a effort underway for that : #1812086: Allow configuration per entity view mode

nancydru’s picture

Status: Needs review » Closed (outdated)