function units_measure_machine_name_load in Units of Measurement 7
Same name and namespace in other branches
- 7.2 units.module \units_measure_machine_name_load()
Load a single entity of type 'units_measure' loading by its machine name.
Parameters
string $machine_name: Machine name of entity to load
Return value
object|bool Return fully loaded entity object if it was found, otherwise FALSE
5 calls to units_measure_machine_name_load()
- UnitsDefaultWebTestCase::testDefaultEntities in units_default/
units_default.test - Conduct testing of enabling/disabling default units.
- UnitsUnitUIController::getBundleEntity in includes/
UnitsUnitUIController.class.inc - Retrieve the bundle (measure) entity whose units are being administered.
- UnitsWebTestCase::testCrud in ./
units.test - Conduct testing of CRUD operations.
- units_convert in ./
units.module - Convert value measured in one unit into value measured in another unit.
- units_unit_by_measure_load_multiple in ./
units.module - Load all units of the supplied measure.
1 string reference to 'units_measure_machine_name_load'
- units_measure_form in ./
units_ui.pages.inc - Generate editing form for entity type 'units_measure'.
File
- ./
units.module, line 344 - Provide API for managing and converting units of measurement.
Code
function units_measure_machine_name_load($machine_name) {
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'units_measure')
->propertyCondition('measure', $machine_name)
->execute();
if (isset($result['units_measure'])) {
$keys = array_keys($result['units_measure']);
$entity_id = array_pop($keys);
return units_measure_load($entity_id);
}
// No entity was found.
return FALSE;
}