You are here

function swftools_get_id in SWF Tools 6.3

Verifies that the supplied id is unique, and assigns an id if one was not supplied.

Typically this is called to get us a unique id, but the user can also supply an id. In all cases we call form_clean_id to verify that the id is unique in this page generation session.

Parameters

string $id: An id to be checked, or empty if we don't have one yet.

bool $clean_id: When TRUE the id will be checked to make sure that it is unique. When FALSE the id will not be checked for uniqueness so the user can be sure the id returned has not been modified unexpectedly. The called is responsible for making sure ids are unique on the page.

Return value

string A form id.

2 calls to swftools_get_id()
swf in ./swftools.module
Processes a file, or an array of files, and returns the relevant mark-up to render a Flash based player.
theme_swftools_api in api/swftools_api.module
Prepares the minimum definition to render Flash, and hands it to the selected embedding function.

File

includes/swftools.core.inc, line 206
Implements SWF Tools core functions that are common to the main module and the API module.

Code

function swftools_get_id($id = '', $clean_id = TRUE) {

  // If a specific id wasn't set then assign one
  $id = $id ? $id : uniqid('swftools-');

  // Return the id, checking that is unique (clean) if required
  return $clean_id ? form_clean_id($id) : $id;
}