webCOMAND

ContentTypeField::enum_value()

Return the Title of the first Field Choice (aka Enumeration) with the specified value.  If no Choice with a corresponding value is found, the value is returned.

Prototype

string enum_value($value, $with = FALSE)

Parameters

  • value - The value of the Choice to find the corresponding Title for.
  • with - Optional WITH to use when the Choices are based on a cPath that references content with one or more Dimensions.

Return

Return the Title of the first Field Choice with the specified value.  If no Choice with a corresponding value is found, the value is returned.

Example

// list the Web Page Status field's 'active' choice title
$repo = comand::repo();
$web_page_ct = $repo->get_content_type('SitesWebPage');
$status_field = $web_page_ct->get_field('Status');
$title = $status_field->enum_value('active');
echo("Status is $title.\n");