/** * Export the step configuration. * * @param renderer_base $output The renderer. * @return object */ public function export_for_template(\renderer_base $output) { global $PAGE; $step = $this->step; $result = (object) ['stepid' => $step->get_id(), 'title' => external_format_text(stepsource::get_string_from_input($step->get_title()), FORMAT_HTML, $PAGE->context->id, 'tool_usertours')[0], 'content' => external_format_text(stepsource::get_string_from_input($step->get_content()), FORMAT_HTML, $PAGE->context->id, 'tool_usertours')[0], 'element' => $step->get_target()->convert_to_css()]; $result->content = str_replace("\n", "<br>\n", $result->content); foreach ($step->get_config_keys() as $key) { $result->{$key} = $step->get_config($key); } return $result; }
/** * Format the current row's content column. * * @param step $step The step for this row. * @return string */ protected function col_content(step $step) { return format_text(step::get_string_from_input($step->get_content()), FORMAT_HTML); }
/** * Ensure that the get_string_from_input function returns langstring strings correctly. * * @dataProvider get_string_from_input_provider * @param string $string The string to test * @param string $expected The expected result */ public function test_get_string_from_input($string, $expected) { $this->assertEquals($expected, \tool_usertours\step::get_string_from_input($string)); }