DrupalBin
Submit Code
About
Recent Posts
Code
1 hour 15 min
ago
Code
13 hours 15 min
ago
scrollbox.js
17 hours 36 min
ago
imagefield_gallery_scrollbox.module
17 hours 36 min
ago
more
Tags
CCK
drupal
fapi
javascript
jquery
menu
module
Panels
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Flexifilter API Lesson #1.5
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
<?php // $Id$ function example_flexifilter_conditions() { $conditions = array(); $conditions['example_text_all_uppercase'] = array( 'label' => t('Text is all uppercase'), 'description' => t('TRUE if all of the text is uppercase'), 'callback' => 'example_condition_isupper', 'group' => t('Text'), ); return $conditions; } function example_condition_isupper($op, $settings, $text) { switch($op) { case 'settings': $form = array(); return $form; case 'prepare': case 'process': return preg_match("/[^A-Z \n\t]/", $text) == 0; default: return $text; } } function example_flexifilter_components() { $components = array(); $components['example_toupper'] = array( 'label' => t('To Uppercase'), 'callback' => 'example_component_toupper', 'group' => t('Text: Simple'), 'step' => 'either', ); return $components; } function example_component_toupper($op, $settings, $text) { switch($op) { case 'settings': $form = array(); $form['case'] = array( '#type' => 'select', '#title' => t('Case transformation'), '#options' => array( 'upper' => t('To Uppercase'), 'lower' => t('To Lowercase'), ), '#default_value' => isset($settings['case']) ? $settings['case'] : 'upper', ); return $form; case 'prepare': case 'process': if ($settings['case'] == 'upper') { return strtoupper($text); } else { return strtolower($text); } default: return $text; } }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.