You are here

function bueditor_plus_profiles in BUEditor Plus 7

Same name and namespace in other branches
  1. 7.2 bueditor_plus.module \bueditor_plus_profiles()

Loads the editor profiles.

Parameters

int $pid: The profile ID of the profile to load. Null will return all profiles. global will return the global profile if set.

Return value

array Either a keyed array of all profiles or a single profile.

4 calls to bueditor_plus_profiles()
bueditor_plus_admin in ./bueditor_plus.admin.inc
Main administration page. Overrides the default BUEditor admin page. We actually grab the bueditor_admin build array and replace the form with our own to represent the new profiles system. The format has been mimicked from the original…
bueditor_plus_form_field_ui_field_edit_form_alter in ./bueditor_plus.module
Implements hook_form_FORM_ID_alter() for field_ui_field_edit_form().
bueditor_plus_process_format in ./bueditor_plus.module
Checks for any bueditor_plus profiles that should be attached and adds the JavaScript settings to implement the format profile.
bueditor_plus_profile_load in ./bueditor_plus.module
Loads a specific profile. Used in menu %bueditor_plus_profile
1 string reference to 'bueditor_plus_profiles'
bueditor_plus_update_7001 in ./bueditor_plus.install
Create the global field.

File

./bueditor_plus.module, line 278
Overrides default BUEditor textarea settling and implements controls based upon text formats.

Code

function bueditor_plus_profiles($pid = NULL) {
  $cache =& drupal_static(__FUNCTION__, NULL);
  if (!$cache) {
    $cache = array(
      'global' => NULL,
    );
    $results = db_select('bueditor_plus_profiles')
      ->fields('bueditor_plus_profiles')
      ->execute();
    foreach ($results as $result) {
      $result->data = unserialize($result->data);
      $cache[$result->pid] = $result;

      // If this profile has the global flag set to 1 then we create our special
      // "global" pid and store it in the cache.
      if ($result->global) {
        $cache['global'] = $result;
      }
    }
  }
  if ($pid) {
    return isset($cache[$pid]) ? $cache[$pid] : FALSE;
  }
  return $cache;
}