84

Every now and then when working with Ctools Page manager, and Panels, it is useful to add custom Ctools plugins. Ctools plugins comes in a large number of forms, and other modules, such as Feeds, Addressfield and Openlayers all make use of Ctools to provide plugins extensible by other modules. The most common forms of plugin though, are probably "content ...


48

Ctools In Ctools, there is a sub-module called "Page manager". This module, at it's core, is a graphical user interface to hook_menu. It allows you to either create new paths in the system, or take over some of the ones provided by Core. Page manager Once Page manager manages a path for you, it can do several different things with it. Out of the box, it ...


11

As the official doc says you can do something like panels-pane_node-title.tpl.php panels-pane_panel_node_title.tpl.php panels-pane-node-title.tpl.php panels-pane-node_title.tpl.php After some search i have found that the suggestions are not detecting by panels, and i end up in this preprocess function. function ...


9

Views Math expression fields use a custom expression parser in the Chaos Tool Suite (ctools) module. The code for this is contained in ctools/includes/math-expr.inc. As of mid-July 2012, the built-in functions are: 'sin','sinh','arcsin','asin','arcsinh','asinh', 'cos','cosh','arccos','acos','arccosh','acosh', 'tan','tanh','arctan','atan','arctanh','atanh', ...


8

Short answer: you should use #ajax['path']. Long answer: Having a ajax callback does not help as ctools creates it's forms differently afaik. The callback done by system/ajax cannot find the complete form definition thus cannot find an element to process the ajax request for. Using #ajax[path] just triggers a menu item. You can check for yourself by ...


8

Assuming you already have the node override Panel enabled: Edit the panel page for the node override (node_view for node/%node) Make a new variant, enable selection rules For the selection rule, choose String: Url Path In the criteria, keep Allow access on the following pages selected In the textarea, add the internal node paths for this nid(s) you want. ...


7

Check out this new feature from the latest dev version of Drush 8.x-6.x: $ drush @dev pm-list --format=csv Administration,Actions permissions (VBO) (actions_permissions),Module,Not installed,7.x-3.1 Administration,Administration Development tools (admin_devel),Module,Not installed,7.x-3.0-rc4 Administration,Administration menu (admin_menu),Module,Enabled,7....


7

This should be possible by invoking Drupal.CTools.Modal.show directly. The function takes one argument (the modal-style), which either can be a string pointing to an object on Drupal.settings or the style-object itself. After showing the dialog, it is possible to populate title and content using jQuery: Drupal.CTools.Modal.show('my-modal-style'); $('#modal-...


7

My final solution was to create a Page Panel with the following path: shop/%product/!optionalArgs % indicates a required argument, ! indicates an optional argument In order to grab all of the "arguments" or URL path after the product (ex: barn), go to Settings » Arguments, select Settings for optionalArgs, and make sure Get all arguments after this one is ...


7

Session variables seem to be the way to go Don't forget that session variables rely on cookies Have I missed any options? The traditional solution would be to use the ip address as a fallback if cookies are disabled. PHP does support an alternative to cookie-based sessions -- it can rewrite the URLs to include "?PHPSESSID=xyz". However, securing this ...


6

As for this issue commited on November '11, you should be able to close any CTools modal window with a link that has the class "ctools-close-modal" For example, in my modal I've got this for element to cancel and close: $form['actions']['cancel'] = array( '#markup' => l(t('Cancel'), '#', array( 'attributes' => array( '...


6

I used the following code in a resent project, hope this helps: Add this code to custom_module.module: /** * Implementation of hook_menu(). */ function custom_module_menu() { $items = array(); // @see node_menu in node.module: // @todo Remove this loop when we have a 'description callback' property. // Reset internal static cache of ...


6

mymodule.module: <?php /** * Implements hook_ctools_plugin_api(). */ function mymodule_ctools_plugin_api() { list($module, $api) = func_get_args(); if ($module == 'mymodule' && ($api == 'plugins')) { return array('version' => 1.0); } } /** * Implements hook_ctools_plugin_type(). */ function mymodule_ctools_plugin_type(...


6

You should try to put this line: form_load_include($form_state, 'inc', 'my_module','plugins/content_types/my_file'); at the top of your content_image_pane_edit_form function, replacing my_module and my_file with your module and plugin include file. Ctools panes are generated in a separate modal from base Drupal forms and so when the AJAX reloads the form ...


5

This post I wrote a while back deals with CTools AJAX events at any time. It involves writing your own Javascript handler and executing it on page load. Drupal.CTools.AJAX.refreshElements = function() { var url = '/mymodule/ajax/refresh-elements'; try { $.ajax({ type: "POST", url: url, data: { 'js': 1, 'ctools_ajax': 1}, ...


5

A good example for using forms on modal dialogs is in Ajax Login/Register module. You could see the module code and understand how it works(ajax_register is using ctools_modal). Or you can render the form manually and use ctools only for the responses. For example: mymodule.module: function mymodule_form($form, &$form_state) { ... ctools_include('...


5

Even faster: PHP is not even needed to just display all values... Under "When the filter value IS available or a default is provided Tick "Specify validation criteria" Choose 'Basic validation' Under "Action to take if filter value does not validate", choose "Display all values"


5

We can achieve this quite easily by using node_view as a guide. First though you must implement hook_ctools_plugin_directory() in your module file to register the ctools plugins: /** * Implements hook_ctools_plugin_directory(). */ function my_entity_ctools_plugin_directory($owner, $plugin_type) { if ($owner == 'page_manager' || $owner == 'ctools' || $...


5

In the image below, one can see the Context settings for a particular Page variant. Under Contexts, one can also see Relationships. Relationships are what one uses to tell Page manager to pull in more, related, data, based on the arguments that the page is built around. With two nodes related to each other with a reference field, and the base node being ...


5

See the API documentation: The correct way to declare the version is by the major number only (i.e. an integer) not the entire version as a string. // code included in my_module.module function my_module_views_api() { return array('api' => 3); }


5

There are no ctools plugins anymore in Drupal 8. There's just the Drupal 8 plugin API. Page Manager, Panels and so on use standard block plugins now in 8.x, so you basically have to port this to a block an then it should work fine. Also, the "code" you posted only defines that you have such a plugin in your module, nothing else. If you need more specific ...


4

I faced the same problem, and I managed to solve it using merlinofchaos's suggestion. I used form_load_include() just after form_state initialization: $form_state = array( 'title' => t('Add new deal'), 'ajax' => TRUE, 'node' => $node, ); $form_state['build_info']['args'] = isset($form_state['build_info']['args']) ? $form_state['...


4

ctools_content_render() is the solution.


4

JavaScript doesn't allow extending a function with another one. If you want to extend modalContentClose() you just redefine it in your JavaScript file that is included after the JavaScript used by ctools.module. modalContentClose = function() { // Add your own code. close(); return false; }; Your version of modalContentClose() cannot refer the ...


4

Crumbs provides a "Breadcrumb (Crumbs)" block that you should be able to use.


4

I found a better explanation here so I'm not going to explain much about the $form_state itself here. To present a form, you have to use drupal_get_form() function that returns a render-able array of the form. To build the form, you need to give a form ID (to get the form API arrays) and the state of the form. Form State ($form_state) becomes handy when ...


4

I doubt it, that would be re-inventing the wheel IMO...what you're describing is pretty much what jQuery is for. Consider this code, which is a basic representation of what you're trying to do: $(function() { $('#some-element').bind('someEvent', function() { $('#some-other-element').val(''); }); }); That's only 3 meaningful lines of code, and is so ...


4

I'll give this a shot. A view mode is a concept that exists for entities. A node has for example the view modes Full content, Teaser and RSS. And as you say different view modes can have different settings. An image might be just an URL in the RSS view mode and a large rendered image in the Full content view mode. It is also possible to have different order ...


4

A view mode is an entity specific concept. It defines how to render a, which could for example determine which fields are displayed and how, but nothing prevents a view mode of a "gallery image" to pull in and render a View that shows the other images in the same gallery for example. A style plugin, as a Panels specific concept, does a similar thing to view ...


4

The /contact page is provided by the Contact module, which you must have enabled. It displays the contact_site_form form, which is declared in /modules/contact/contact.pages.inc. Configuration options for this form can be found at the site.com/admin/structure/contact URL. If you're looking to change form structure, you may need to create a custom module ...


Only top voted, non community-wiki answers of a minimum length are eligible