function xbbcode_list_autocomplete in Extensible BBCode 8
Same name and namespace in other branches
- 5 xbbcode_list/xbbcode_list.module \xbbcode_list_autocomplete()
- 6 xbbcode_list/xbbcode_list.module \xbbcode_list_autocomplete()
- 7 xbbcode_list/xbbcode_list.module \xbbcode_list_autocomplete()
1 string reference to 'xbbcode_list_autocomplete'
- xbbcode_list_menu in xbbcode_list/
xbbcode_list.module
File
- xbbcode_list/
xbbcode_list.module, line 180
Code
function xbbcode_list_autocomplete($string) {
$styles = array(
'upper-alpha',
'lower-alpha',
'upper-roman',
'lower-roman',
'numeric',
);
$results = array();
if (preg_match('/^(.*,\\s*)?(.*)$/', check_plain($string), $match)) {
list($first, $last) = array(
$match[1],
$match[2],
);
$length = drupal_strlen($last);
foreach ($styles as $style) {
if (drupal_substr($style, 0, $length) == $last) {
$results[$first . $style] = $style;
}
}
}
drupal_json_output($results);
}