markup.inc in Webform 5
File
components/markup.inc
View source
<?php
function _webform_edit_markup($currfield) {
$edit_fields = array();
$edit_fields['mandatory'] = array();
$edit_fields['value'] = array(
'#type' => 'textarea',
'#title' => t("Value"),
'#default_value' => $currfield['default'],
'#description' => t('Markup allows you to enter custom HTML or PHP logic into your form.') . '<br />' . webform_help('webform/helptext#variables'),
'#weight' => -1,
);
$edit_fields['extra']['filter'] = filter_form($currfield['extra']['format'], 0, array(
'field',
'extra',
'format',
));
$edit_fields['extra']['description'] = array();
return $edit_fields;
}
function _webform_render_markup($component) {
if ($_POST['op'] == t('Preview')) {
$check_filter = true;
}
else {
$check_filter = false;
}
$form_item = array(
'#type' => 'markup',
'#weight' => $component['weight'],
'#value' => _webform_filtervalues(check_markup($component['value'], $component['extra']['format'], $check_filter), FALSE),
'#prefix' => '<div class="webform-component-' . $component['type'] . '" id="webform-component-' . $component['form_key'] . '">',
'#suffix' => '</div>',
);
return $form_item;
}
function _webform_submission_display_markup($data, $component, $enabled = false) {
$form_item = _webform_render_markup($component);
return $form_item;
}
function _webform_help_markup($section) {
switch ($section) {
case 'admin/settings/webform#markup_description':
$output = t("Presents a markup area of text. Does not render a field.");
break;
}
return $output;
}
Functions
Name |
Description |
_webform_edit_markup |
Create a set of form items to be displayed on the form for editing this
component. Use care naming the form items, as this correlates directly to the
database schema. The component "Name" and "Description" fields are added to
every… |
_webform_help_markup |
Module specific instance of hook_help(). |
_webform_render_markup |
Build a form item array containing all the properties of this component. |
_webform_submission_display_markup |
Display the markup in the results. The output of this function will be
displayed under the "results" tab then "submissions". |