- ⌂ cObject
- Methods
- Constructor
- add_variant()
- approve()
- as_array()
- can_add_variant()
- can_delete_variant()
- can_edit_variant()
- can_reorder_variant()
- clone()
- delete()
- edit_variant()
- enum()
- get_active_object()
- get_all_variants()
- get_attributes()
- get_dimensions()
- get_dimension_with()
- get_parent()
- get_primary_cpath()
- get_variant()
- Keywords()
- lock_object()
- reload_data()
- repo()
- revert()
- save()
- store()
- unlock_object()
- update_from_array()
- validate()
cObject::get_variant()
Returns the object that corresponds with the given set of dimensions, i.e. the 'French' version of a web page if passing the French dimension object.
An object will be returned only if one exists with exactly these specified dimensions. If the object content type defines multiple dimension fields, but only one is provided in $dimension, then only the variant with just that dimension field set (and the others are not set) will be returned.
Prototype
Content get_dimension(cObject|array $dimensions)
Parameters
- dimensions - Single dimension object, or array of dimension objects that correspond to the dimensions of the desired variant of this object.
Return
The variant representing the specified dimension(s) exactly, or NULL if not found.
Example
$repo = comand::repo();
// get Spanish Language Dimension Value
$es = $repo->get_first('FROM Language WHERE Title='Spanish');
// get the Spanish version of an Article
$article = $repo->get_first('FROM Article LIMIT 1');
$article_es = $article->get_dimension([$es]);
if($article_es) {
echo("$article_es\n");
} else {
echo("No Spanish version exists\n");
}