1

I've looked everywhere and can't find an answer to my problem. I'm trying to do something that seems like it would be relatively simple, but I keep coming up empty: add a pop-up text link to the "node/add/content" form for just one of my content types.

I've figured out how to use the popup module (https://www.drupal.org/project/popup) to make pop-up text elements using blocks, but that won't help me when it comes to the add content page. The idea here is to give users instructions on how to fill out the "add content" form on the form itself. Since I'm using an overlay screen, it makes the most sense to include the link directly on the form itself.

I've seen many places where people suggest a variation on this: Base tpl file for "add content" page?. In other words, copying the node file contents to a new file called page--node--add--my-content-type.tpl.php in the base theme directory, but this has no effect for me.

Also, I've tried to use the Theme Developer module to figure out what the page is called, but enabling this module just breaks the form for me, rendering Devel useless.

Do I need to somehow manipulate the template.php file in my theme? Any direction anyone can give me would be great. Thank you in advance.

2

Have you considered hook_form_alter and the usage of either of these 2 modules:

BeautyTips, which allows:

The Beautytips module provides ballon-help style tooltips for any page element by integrating the BeautyTips jQuery Tooltip plugin by Jeff Robbins with Drupal. It provides an API for adding custom beautytips as well as some built-in features. Admins can enable rollover balloon-help style tooltips for text fields within forms. It also supplies hover tips for Drupal help links and advanced help links.

Most importantly, it allows developers to add their own custom beautytips popups to their site without having to delve into jQuery.

Guided Tours, which allows:

Gives content creators the ability to build tours on their sites which allow users to better understand complex workflows on the site and be guided through those workflows. The main advantage of this module is that you can build tours leading the user through multiple different pages with multiple tooltips on one page/step. This module uses qTip and jgrowl_d7.

EDIT

As an example for /node/add/page the recipe would be:

  1. Implement hook_form_alter in a custom module for this pages $form.
  2. For any form item of the form you want to add a beauty tip for add a class so you can find it easily using beauty tips.
  3. For instance then at the end of your hook_form_alter function you then can add the beauty tips calls following the documentation. You can use your helper CSS classes to make your life somewhat easier.
  4. repeat (1) thru (3) as necessary ...

    # in file mymodule.module
    
    // This is step #1.
    function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
      // This is step #1. Or target 'page_node_form', or use a Regex for certain forms.
      if ($form_id == 'student_blog_node_form') {
        // This is step #2. See https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#attributes 
        $form['field_survey_program']['#attributes']['class'][] = 'my-beauty-tip';
      }
    
      // This is step #3. See: http://cgit.drupalcode.org/beautytips/tree/README.txt?id=HEAD
      $options['bt_drupal_help_page'] = array(
          // what selects the content from the page using css selectors.
          'cssSelect' => '.my-beauty-tip',
          // what to show in the tooltip.
          'text' => 'This is my tooltip!',
          'trigger' => array(0 => 'mouseover', 1 => 'click'),
          'width' => 350,
        );
        beautytips_add_beautytips($options);
    }
    
  • Thank you for your comment, @tenken. I will look into those modules and then report back here. – Drupguy Aug 18 '14 at 22:23
  • I'm now using BeautyTips, @tenken, but I'm struggling a bit. I found a tutorial (lullabot.com/blog/articles/…) but am unsure both where to implement the code, and how to use "hook_form_alter" with it. I tried adding this to the template.php file, but it's incorrect: "$('h2').bt('I am an H2 element!', { trigger: 'click', positions: 'top' });" Where does "function beautytips_form_alter(&$form, $form_state, $form_id)" go? Should I be working in the BeautyTips module instead of the template.php file? Thank you in advance for your guidance. – Drupguy Aug 20 '14 at 16:51
  • @Drupguy see my edit. goodluck. – tenken Aug 20 '14 at 17:42
  • Awesome, @tenken! Thank you very much! I'll try this out and let you know how it goes. – Drupguy Aug 20 '14 at 17:50
  • i leave it to you to figure out what CSS selectors (items on the page) to add tips to. beauty tips defaults to the "selected contents" title attribute ... figure out what works for you. – tenken Aug 20 '14 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.