$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);
/** * Implements hook_views_api(). */ function my_module_views_api() { return array( 'api' => 3, ); }
/** * Implements hook_views_data_alter(). */ function my_module_views_data_alter(&$data) { $data['node']['title_count']['title_multiple'] = 'Title multiple wrods'; $data['node']['title_count']['help_multiple'] = 'Filter multiple words with or operation in Title field'; $data['node']['title_count']['filter_multiple']['handler'] = 'my_module_handler_filter_multiple_word'; }
; Views handlers files[]=views/my_module_handler_filter_multiple_word.inc
class my_module_filter_multiple_word_handler extends views_handler_filter_string{ function operators(){ $operators = parent::operators(); $operators['multiple word match'] = array( 'title' => t('Match multiple words'), 'short' => t('has multiple'), 'method' => 'op_word', 'values' => 1, ); return $operators; } function op_word($field) { $where = $this->operator == 'word' ? db_or() : db_and(); // Don't filter on empty strings. if (empty($this->value)) { return; } $matches = $split_arr = preg_split('/[ ;;,,、\r\n\t]+/ui', $this->value); if( empty($matches) ) return ; if( $matches[0]=="" ) unset($matches[0]); $where->condition("node.title", $matches, 'IN'); if (!$where) { return; } // previously this was a call_user_func_array but that's unnecessary // as views will unpack an array that is a single arg. $this->query->add_where($this->options['group'], $where); } /** * Provide a simple textarea for equality */ function value_form(&$form, &$form_state) { // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only // render the form items we need. $which = 'all'; if (!empty($form['operator'])) { $source = ($form['operator']['#type'] == 'radios') ? 'radio:options[operator]' : 'edit-options-operator'; } if (!empty($form_state['exposed'])) { $identifier = $this->options['expose']['identifier']; if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) { // exposed and locked. $which = in_array($this->operator, $this->operator_values(1)) ? 'value' : 'none'; } else { $source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']); } } if ($which == 'all' || $which == 'value') { $form['value'] = array( '#type' => 'textarea', '#title' => t('Value'), '#rows' => 10, '#resizable' => TRUE, '#default_value' => $this->value, ); if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) { $form_state['input'][$identifier] = $this->value; } if ($which == 'all') { $form['value'] += array( '#dependency' => array($source => $this->operator_values(1)), ); } } if (!isset($form['value'])) { // Ensure there is something in the 'value'. $form['value'] = array( '#type' => 'value', '#value' => NULL ); } } }
$form['#attached']['js'] = array( drupal_get_path("module", "drills_custom_views")."/js/drills_title_form_check.js" );
$form_id = "views-exposed-form-".$form_state['view']->name."-".$form_state['view']->current_display ; $form_id = str_replace( "-", "_", $form_id ); drupal_add_js(array('drills_custom_views' => array('form_id' => $form_id)), array('type' => 'setting'));
(function($) { Drupal.behaviors.drills_custom_views = { attach: function (context, settings) { alert(settings.drills_custom_views.form_id); } }; })(jQuery);