Declare custom functions to pick contextual filter default values, easily.

Creating ctools plugins is an undue barrier to controlling contextual filter default values. This is a common site scenario that increases the power of Views. Also creating a very focused function to find a value helps keep concerns separate and improves testability.

Register your custom function via info hook.

function mymodule_views_contextual_filter_function_info() {
  return (object) array(
    'label' => 'Get some magical filter value',
    'function' => 'mymodule_get_value_somehow',
  );
}
Supporting organizations: 

Project information

Releases