Search code examples
drupal-7

Concatenation with %keyword in mini-panels


Someone posted another question https://drupal.stackexchange.com/questions/195860/how-does-one-concatenate-fields-in-title-field-in-panels-pages but its not working for me.

I need to concatenate a custom text as prefix with %node:field_city_title keyword while adding a node field in mini-panels.

I tried with Event in %node:field_city_title , Event in%node:field_city_title and searched a lot but nothing works for me.

enter image description here

If you any idea, let me know


Solution

  • I've figured out but not sure either it's a standard way or not but I believe override title field is not accepted "prefix or postfix" for %keyword like mentioned in the question.

    Solution

    1) Removed tag h1 from the attached image in the question.

    2) Created new tpl named as panels-pane--event-node-title.tpl.php and added some code in it

    <div class="pane-content">
      <?php if ($title): ?>
      <h1> <?php print $title; ?> </h1>
      <?php else : ?>
        // Here we can set any prefix or postfix within the tag
        <h1> Event in <?php print render($content); ?> </h1>
      <?php endif; ?>
    </div>
    

    $content variable will get content of the field along with its all settings (ID, class, tag etc.)

    Hope, this will help someone. Thanks