This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand

After creating or loading a Content Item, various "get" and "set" methods are available.

"get" methods

Although JCckContent class supports method chaining, these methods return what you ask for (and not the instance).

var_dump( $content->getAuthor() );

Returns the value of the "author" property (i.e. the value of "created_by" for Joomla! Articles, or the value of "created_user_id" for Joomla! Categories, or...).

var_dump( $content->getData() ); 

Returns an array with all properties and values of a the content item.

var_dump( $content->getData( $table_instance_name ) );

Returns an array with all properties and values of a specific table instance of the content item.

var_dump( $content->getId() ); 

Returns the SEBLOD IDentifier of the content item (i.e. the primary key of the "core" table).

var_dump( $content->getObject() ); 

Returns the object of the content item or instance (i.e. "joomla_article", or "joomla_category", or any other object...).

var_dump( $content->getParent() ); 

Returns the value of the "parent" property (i.e the value of "catid" property for Joomla! Articles, or the value of "parent_id" property for Joomla! Categories, or...).

var_dump( $content->getPk() );

Returns the Primary Key of the content item (i.e the primary key of the "base" table).

var_dump( $content->getProperty( 'title' ) );

Returns the value of a property.

var_dump( $content->getRegistry( 'params' ) ); @ SEBLOD 3.17.0

Returns a Registry object of a property. Useful for any property storing multiple "sub-properties" in a JSON format.

var_dump( $content->getRegistry( 'params' )->get( 'param1' ) ); @ SEBLOD 3.17.0

Returns the value of a sub-property param1 from a JSON string {"param1":"value1","param2":"value2"}

var_dump( $content->getTable() );

Returns the table of the content item or instance (i.e. "#__content" for Joomla! Articles, or "#__categories" for Joomla! Categories, or...).

var_dump( $content->getType() );

Returns the type of the content item (i.e. the Content Type).



"set" methods

As JCckContent class supports method chaining, these methods return the instance, so you can chain additional calls.

$content->setProperty( 'title', 'My Title' );

Sets the value of a property. This method only changes the value within the current instance BUT doesn't update the DB.