You are here

function webform_features_machine_name_load in Webform Features 7.4

Same name and namespace in other branches
  1. 7.3 webform_features.module \webform_features_machine_name_load()

Menu argument loader: loads a webform by string.

Parameters

$name: The machine-readable name of a webform to load, where '_' is replaced with '-'.

$reset: Whether to reset the node_load_multiple cache.

Return value

A webform object or FALSE if $name does not exist.

4 calls to webform_features_machine_name_load()
webform_features_export in ./webform_features.features.inc
Implements hook_features_export().
webform_features_export_render in ./webform_features.features.inc
Implements hook_features_export_render().
webform_features_install in ./webform_features.install
Implements hook_install().
webform_features_rebuild in ./webform_features.features.inc
Implements hook_features_rebuild().
1 string reference to 'webform_features_machine_name_load'
webform_features_form_alter in ./webform_features.module
Implements hook_form_alter().

File

./webform_features.module, line 90
This module allows to export Webforms into Features.

Code

function webform_features_machine_name_load($name, $reset = FALSE) {
  $name = strtr($name, array(
    '-' => '_',
  ));
  $nid = db_select('webform', 'w')
    ->fields('w', array(
    'nid',
  ))
    ->condition('machine_name', $name)
    ->execute()
    ->fetchField();
  if (empty($nid)) {
    return FALSE;
  }
  return node_load($nid, NULL, $reset);
}