Blog API (D7)

A fork has been created of the blogapi.module called blogapi_new to build improvements based around Drupal 6 with the goal of then merging them back into Drupal 7.

Blog API has been removed from Drupal 7. It is now located here.

Display a confirmation message before processing a form

Sometimes it is useful to display a confirmation message before processing a form, especially when doing something irreversible, like deleting content. To see examples in core, look at the list of functions which call confirm_form. This page explains how to adapt the Form API process to support confirmation messages. The process for multi-stage forms is very similar.

The Form API process is:

  1. Display the form to the user (using the form function)
  2. Validate (using form_validate)
  3. Submit (using form_submit) and process
  4. Display the result to the user

To put a confirmation form in the middle we end up running through that process twice because there are now two page views, so it looks something like this:

  1. Display the form to the user (using the form function)
  2. Validate (using form_validate)
  3. Submit (using form_submit) and rebuild the form
  4. Display the confirmation form to the user (using the form function)
  5. Validate (using form_validate)
  6. Submit (using form_submit) and process
  7. Display the result to the user and redirect if desired

So there are the following things to deal with compared to a normal form:

    Image module: Troubleshooting

    Before filing a bug or support request on image module, please check the following:

    Basics

    - Have you cleared your cache? If you're unsure how to do this, install either Admin menu or Devel module.
    - Are you really using image module? This sounds daft but lots of modules are called image_something or something_image.
    - Are you using Drupal core uploads (or another module that makes use of them) on image nodes?
    - Is your image node type really being handled by image module? If you made your own node type called 'image' before installing image module, then image module cannot function properly.
    - Is your files directory correctly set up? See http://drupal.org/node/281115 for more steps.

    Image import

    - Symptom: User has import_image module: import images permission, drupal has filesystem r/w permissions, but import silently fails. Failure is logged as error without helpful information.
    - Remedy: The import image permission controls access to the import tool, but is not sufficient to actually execute the import. Give the import permission to a user you want to be listed in the node as the image owner and also give him image module: create images permission.

    Image gallery

    - Does the image gallery vocabulary exist?
    - Does it have terms?

    Icons, Hyperlinks & Description text in your Nice Menu's.

    It is possible to custom theme your Nice Menu's allowing the addition of icons, additional hyperlinks and a bit of HTML formatted description text right inside the menu itself giving your drop-down menu's a very rich and interactive presentation.

    Please note that this is not a simple module solution and requires overriding the theme function provided in nice_menus.module. In addition, it will require a more than fair proficiency with CSS to get everything working the way you'd like.

    You can view an example of the finished product at www.3xlogic.com to see what we are trying to achieve.

    1) How the Nice Menu Tree and Menu Links are built by default.

    Nice Menu's uses a function called theme_nice_menu_tree to build the tree of UL's and LI's that are wrapped around the Drupal core menu items. This function is found in the nice_menus.module. Within the tree, it places the Drupal menu items inside of the LI elements by calling a system function called menu_item_link($mid) as shown below. All that happens is that Nice Menu's gives menu_item_link a Menu ID # ($mid) and menu_item_link returns a formatted url wrapped in anchor tags including the Drupal menu's title as the link text and the description as the alt-title tag (the part that shows like tool-tip).

    magento_products

    Overview

    Module synchronizes Magento products catalogue to Drupal content.

    During installation of module, new content type product is created, which is being used for storing information of product. Necessary fields are created for that content type:
    Product ID - the ID of product
    Description - description of product
    Short Description - short description of product
    SKU - the SKU of product
    Weight - weight of product
    Price - price of product
    Special Price - special price of product
    Special Price from date - start date of product special price
    Special Price to date - end date of product special price
    New from date - start date of marking product as New
    New to date - end date of marking product as New
    Status - status of product
    Visibility - visibility of product
    Stock Availability - availability of product in stock
    Rule ID - the ID of applied rule
    Discount price - information of product price considering applied rules
    Tier price - information of Tier Price
    Image - image of product

    Function overview

    magento_products_settings()

    Description: Function outputs the form of product synchronization settings.
    It allows to specify the time of keeping data in cache: Always, Temporarily or Specify time in hours.

    magento_products_cache_time_validate()

    magento_users module

    Overview

    Module automatically synchronizes Drupal users to Magento. Upon any action with Drupal user (creation, edition or removal), similar event is performed at Magento.
    Also module allows to set up correspondences between user roles at Drupal and user groups at Magento. Each Drupal role is set up in correspondence with Magento user group at admin page.

    Module's installation process

    During installation, module creates magento_groups table in Drupal database used to store the correspondences between Drupal roles and Magento user groups.

    Functions description

    magento_users_roles_propagation()

    Description: Function calls magento_users_roles_propagation_form form.
    This form is used to set up to set up correspondences between user roles at Drupal and user groups at Magento. Drupal makes a query about getting the list of user groups to Magento. It's possible to select one user group from the list for each user role. Upon form (magento_users_roles_propagation_form_submit) submission, all the correspondences are saved to database table (new entries are created or existing are updated).

    magento_users_get_group($id)

    Arguments: $id is the ID of user role
    Return value: $group_id is the ID of user group
    Description: Using received user role ID, function figures corresponded user group at Magento.

    Pages

    Subscribe with RSS Subscribe to RSS - Programmers