function clean_markup_panels_clean_element_pane_settings_form in Clean Markup 7.2
Same name and namespace in other branches
- 7.3 modules/clean_markup_panels/plugins/styles/clean/clean_element.inc \clean_markup_panels_clean_element_pane_settings_form()
Form constructor for the pane settings form.
You see this when you click on the gear in the top-right of a panel pane, and click "Change" under "Style", and choose "Clean panel markup".
1 string reference to 'clean_markup_panels_clean_element_pane_settings_form'
- clean_element.inc in modules/
clean_markup_panels/ plugins/ styles/ clean/ clean_element.inc - Clean markup panels clean element panels style.
File
- modules/
clean_markup_panels/ plugins/ styles/ clean/ clean_element.inc, line 53 - Clean markup panels clean element panels style.
Code
function clean_markup_panels_clean_element_pane_settings_form($style_settings) {
$settings = array();
$form = array();
// Set defaults.
if (array_key_exists('clean_markup', $style_settings) && !empty($style_settings['clean_markup'])) {
$settings = $style_settings['clean_markup'];
}
$settings += array(
'pane_wrapper' => 'div',
'enable_inner_div' => FALSE,
'additional_pane_classes' => implode(' ', array(
'panel-pane',
)),
'additional_pane_attributes' => '',
'title_wrapper' => 'h2',
'content_wrapper' => CLEAN_MARKUP_NO_ELEMENT,
'title_hide' => FALSE,
);
$wrapper_elements = _clean_markup_get_html_wrapper_elements();
$optional_wrapper_elements = _clean_markup_get_html_wrapper_elements(TRUE);
// Show the config form to the user if they're allowed to modfiy it.
if (user_access('administer clean markup panel pane settings')) {
$form['clean_markup'] = array(
'#type' => 'fieldset',
'#title' => t('Clean markup options'),
);
$form['clean_markup']['pane_wrapper'] = array(
'#type' => 'select',
'#title' => t('Pane wrapper markup'),
'#description' => t('Choose the HTML element to wrap the pane.'),
'#default_value' => $settings['pane_wrapper'],
'#options' => $optional_wrapper_elements,
);
$form['clean_markup']['additional_pane_classes'] = array(
'#type' => 'textfield',
'#title' => t('Additional pane classes'),
'#description' => t('Additional classes to set on the pane wrapper.'),
'#default_value' => $settings['additional_pane_classes'],
'#states' => array(
'invisible' => array(
':input[name="settings[clean_markup][pane_wrapper]"]' => array(
'value' => CLEAN_MARKUP_NO_ELEMENT,
),
),
),
);
$form['clean_markup']['additional_pane_attributes'] = array(
'#type' => 'textfield',
'#title' => t('Additional attributes'),
'#description' => t('Additional attributes to set on the pane wrapper (i.e. <code>role="navigation"</code>). Text entered here will not be sanitized.') . '<br />' . t('While this is a powerful and flexible feature if used by a trusted user with HTML experience, it is a security risk in the hands of a malicious or inexperienced user.'),
'#default_value' => $settings['additional_pane_attributes'],
'#states' => array(
'invisible' => array(
':input[name="settings[clean_markup][pane_wrapper]"]' => array(
'value' => CLEAN_MARKUP_NO_ELEMENT,
),
),
),
);
if (module_exists('token')) {
$form['clean_markup']['token_help'] = array(
'#title' => t('Replacement patterns'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!'),
'#states' => array(
'invisible' => array(
':input[name="settings[clean_markup][pane_wrapper]"]' => array(
'value' => CLEAN_MARKUP_NO_ELEMENT,
),
),
),
);
$form['clean_markup']['token_help']['help'] = array(
'#value' => theme('token_tree', array(
'global',
), TRUE, TRUE),
);
$form['clean_markup']['token_help']['help']['tokens'] = array(
'#theme' => 'token_tree',
'#token_types' => array(
'global',
),
'#global_types' => TRUE,
'#click_insert' => TRUE,
);
}
$form['clean_markup']['enable_inner_div'] = array(
'#type' => 'checkbox',
'#title' => t('Enable inner div'),
'#description' => t('Specify if you want an inner div element inside the main pane wrapper.'),
'#default_value' => $settings['enable_inner_div'],
'#states' => array(
'invisible' => array(
':input[name="settings[clean_markup][pane_wrapper]"]' => array(
'value' => CLEAN_MARKUP_NO_ELEMENT,
),
),
),
);
// Controls for title markup.
$form['clean_markup']['title_wrapper'] = array(
'#type' => 'select',
'#title' => t('Title wrapper markup'),
'#description' => t('Choose the HTML to use to wrap the block title.'),
'#default_value' => $settings['title_wrapper'],
'#options' => $wrapper_elements,
);
$form['clean_markup']['title_hide'] = array(
'#type' => 'checkbox',
'#title' => t('Visually-hide pane title'),
'#description' => t('Add the <code>element-invisible</code> CSS class to the pane title. This hides it visually but leaves it visible to screenreaders.'),
'#default_value' => $settings['title_hide'],
);
// Controls for content markup.
$form['clean_markup']['content_wrapper'] = array(
'#type' => 'select',
'#title' => t('Content wrapper markup'),
'#description' => t('Choose the HTML to use to wrap the block content.'),
'#default_value' => $settings['content_wrapper'],
'#options' => $optional_wrapper_elements,
);
}
else {
drupal_set_message(t('You do not have permission to modify these clean markup settings.'), 'warning');
$form['clean_markup']['pane_wrapper'] = array(
'#type' => 'value',
'#value' => $settings['pane_wrapper'],
);
$form['clean_markup']['additional_pane_classes'] = array(
'#type' => 'value',
'#value' => $settings['additional_pane_classes'],
);
$form['clean_markup']['additional_pane_attributes'] = array(
'#type' => 'value',
'#value' => $settings['additional_pane_attributes'],
);
$form['clean_markup']['enable_inner_div'] = array(
'#type' => 'value',
'#value' => $settings['enable_inner_div'],
);
$form['clean_markup']['title_wrapper'] = array(
'#type' => 'value',
'#value' => $settings['title_wrapper'],
);
$form['clean_markup']['title_hide'] = array(
'#type' => 'value',
'#value' => $settings['title_hide'],
);
$form['clean_markup']['content_wrapper'] = array(
'#type' => 'value',
'#value' => $settings['content_wrapper'],
);
}
return $form;
}