Skip to content

Instantly share code, notes, and snippets.

@dpobel
Created June 1, 2012 09:23
Show Gist options
  • Select an option

  • Save dpobel/2850696 to your computer and use it in GitHub Desktop.

Select an option

Save dpobel/2850696 to your computer and use it in GitHub Desktop.
Version and language list of a content object
<?php
$object = eZContentObject::fetch( 98 );
foreach ( $object->attribute( 'versions' ) as $version )
{
$cli->output( 'Version ' . $version->attribute( 'version' ) );
$languages = eZContentLanguage::decodeLanguageMask( $version->attribute( 'language_mask' ) );
$cli->output( 'This version exists in ' . count( $languages['language_list'] ) . ' languages' );
foreach ( $languages['language_list'] as $languageId )
{
$language = eZContentLanguage::fetch( $languageId );
$cli->output( ' - In ' . $language->attribute( 'name' ) );
$attributes = $version->contentObjectAttributes( $language->attribute( 'locale' ) );
foreach ( $attributes as $attribute )
{
$cli->output( ' o ' . $attribute->attribute( 'contentclass_attribute_identifier' ) . ' : ' . $attribute->toString() );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment