I'm trying to define a Panels visibility rule (access plugin) programmatically but I'm running into a problem.
My code is below. This code works as a Selection Rule (on the Access tab), but when I try to add my access plugin as a Visibility Rule (on the Content tab), the plugin is added to the panel pane, but it doesn't show up in the UI under "Visibility rules." So there's no way to delete it, and the title isn't shown.
I assume I failed to declare something that makes it show up in the Visibility Rules, but I haven't been able to figure out what. I was following this guide, but my plugin is simpler than the one in the example (no configuration necessary).
<?php
/**
* @file
* Plugin to check whether the value matches the proximity query string
* https://drupal.stackexchange.com/questions/33336/what-are-ctools-plugin-content-type-access-etc-and-how-does-one-create-them/33337#33337
*/
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
*/
$plugin = array(
'title' => t("Check proximity query string"),
'description' => t('Returns FALSE if the proximity search query string is set'),
'callback' => 'mymodule_checkproxquerystring_ctools_access_check',
'settings form' => 'mymodule_checkproxquerystring_ctools_access_settings',
);
/**
* Settings form for the 'term depth' access plugin.
*/
function mymodule_checkproxquerystring_ctools_access_settings($form, &$form_state, $conf) {
return $form;
}
/**
* Check for access.
*/
function mymodule_checkproxquerystring_ctools_access_check($conf, $context) {
if (isset($_GET['d']) && (is_numeric($_GET['d']))) {
return FALSE;
}
else {
return TRUE;
}
}