You are here

function _scald_context_type_extract in Scald: Media Management made easy 7

Helper function to extract context name and type name from a string.

Parameters

string $string: The array key to extract the context/type name from.

string $object: The object name to extract : can be type or context.

Return value

string The machine name of the extracted object.

3 calls to _scald_context_type_extract()
scald_context_type_features_export in ./scald.features.inc
Implements hook_features_export().
scald_context_type_features_export_render in ./scald.features.inc
Implements hook_features_export_render().
scald_context_type_features_rebuild in ./scald.features.inc
Implements hook_features_rebuild().

File

./scald.features.inc, line 158
File name: scald.features.inc.

Code

function _scald_context_type_extract($string, $object = 'context') {
  $regex = "/(.+)-(.+)/";
  preg_match($regex, $string, $matches);
  if ($object == 'context') {
    return $matches[1];
  }
  else {
    return $matches[2];
  }
}