Other functionalities: refresh, check, trash, remove, publish...

Last updated on
30 April 2025

In this section we will describe the operations involved in some other functionalities not related to the execution.

Refresh all

  • The operation to refresh the patterns list is performed using AJAX. The js/patterns.js file contains a function that will ask the server for the service to be consumed at admin/patterns/refresh. In this case the function will be patterns_io_get_patterns_service() (in the file includes/io/io.inc):
    • It retrieves again the list of patterns calling patterns_io_get_patterns().
    • It will call the theme function with patterns_list() as a hook, so the theme_patterns_list() function will be called with the new values.

Check a pattern

  • When a pattern is checked, the function patterns_modules_page() is called using the PID as an argument.
  • This function (in the file theme/modules.inc) checks the current list of modules installed in the system and inform of the ones that should be enabled in order to run the pattern properly:
    • Load the Pattern object and get its modules section.
    • Load the system modules list
    • Iterate through the list of modules required by our pattern to check if it exists and is enabled.

Trash/Restore a pattern

  • When a pattern is trashed, the function patterns_trash_pattern() (patterns.module) is called, returning a confirmation form.
  • If the operation is confirmed, the patterns_trash_pattern_submit() (patterns.module) is executed. This function will simply call the auxiliary function patterns_db_trash_pattern() (includes/db.inc) to change the value of the "status" attribute in the database.
  • Restores performs a similar operation by calling the function patterns_restore_pattern() (patterns.module), but without any confirmation form

Remove a pattern

  • When a pattern is deleted, the function patterns_remove_pattern() (patterns.module) is called, returning a confirmation form.
  • If the operation is confirmed, the patterns_remove_pattern_submit() (patterns.module) is executed. This function will simply call the auxiliary function patterns_io_remove_pattern() (includes/io.inc) that will remove it from both places: the filesystem and the database.

Publish/Unpublish a pattern

  • When a pattern is published, the function patterns_publish_pattern() (includes/servers.inc) is called. This function will call directly the auxiliary function patterns_db_publish_pattern() (includes/db.inc) that will change the "public" value of that row in the database. It will also call module_invoke_all() to give a chance to all the modules that implement the hook_patterns_publish() to perform any necessary operation.
  • An equivalent operation is performed with patterns_unpublish_pattern()

Help improve this page

Page status: Not set

You can: