eZ Community » Forums » Developer » Alterate ContentClass from PHP code
expandshrink

Alterate ContentClass from PHP code

Alterate ContentClass from PHP code

Monday 13 February 2012 4:09:25 pm - 3 replies

Hi there,

I would like to automaticalu modify some classes to make them containers.

I can test if they are containers with :

$class = eZContentClass::fetch( $class_id );
 
if ( $class->IsContainer == 0 )
{
    return false;
}
 
return true;

But I don't find how to change this state.

I suppose there is something to do with eZContentClassEditHandler but I don't understand how to use it.

Could someone help me ?

Thanks,

Damien

Monday 13 February 2012 4:22:27 pm

Hi Damien,

I guess the $class is a object, so you can just set the value. I have not tried it, but something like the code provided may work happy.gif Emoticon

 $class = eZContentClass::fetch($class_id);
 
$class->setAttribute('is_container', 1);
$class->store();

Monday 13 February 2012 4:38:57 pm

Hi Anders,

You were fully right ! happy.gif Emoticon

 

Thank you very much !

Tuesday 14 February 2012 8:17:06 am

Cool happy.gif Emoticon

No problem, glad to help!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from