MDL-43738 behat: More info about how to get/set fields
[moodle.git] / admin / tool / behat / renderer.php
index cc5b4ab..0454436 100644 (file)
@@ -84,6 +84,33 @@ class tool_behat_renderer extends plugin_renderer_base {
                 $stepsdefinitions
             );
 
+            $stepsdefinitions = preg_replace_callback('/(FIELD_VALUE_STRING)/',
+                function ($matches) {
+                    global $CFG;
+
+                    // Creating a link to a popup with the help.
+                    $url = new moodle_url(
+                        '/help.php',
+                        array(
+                            'component' => 'tool_behat',
+                            'identifier' => 'fieldvalueargument',
+                            'lang' => current_language()
+                        )
+                    );
+
+                    // Note: this title is displayed only if JS is disabled,
+                    // otherwise the link will have the new ajax tooltip.
+                    $title = get_string('fieldvalueargument', 'tool_behat');
+                    $title = get_string('helpprefix2', '', trim($title, ". \t"));
+
+                    $attributes = array('href' => $url, 'title' => $title,
+                        'aria-haspopup' => 'true', 'target' => '_blank');
+
+                    $output = html_writer::tag('a', 'FIELD_VALUE_STRING', $attributes);
+                    return html_writer::tag('span', $output, array('class' => 'helptooltip'));
+                },
+                $stepsdefinitions
+            );
         }
 
         // Steps definitions.