0

createAction: is it possible to set newly created records (frontend) to "hidden" by default?

I want the Backend Admin to check them first and make them public afterwards.

2 Answers2

2

In your model class add 'hidden' property with getter and setter like this:

/**
 * hidden
 *
 * @var \integer
 */
protected $hidden;

/**
 * Returns the hidden
 *
 * @return \integer $hidden
 */
public function getHidden() {
    return $this->hidden;
}

/**
 * Sets the hidden
 *
 * @param \integer $hidden
 * @return void
 */
public function setHidden($hidden) {
    $this->hidden = $hidden;
}

Then you can call it in your createAction method in your controller:

$model->setHidden(TRUE); 
gSorry
  • 1,254
  • 2
  • 21
  • 29
1

Add the below TSConfig code:

TCAdefaults {
   tt_content.hidden = 1
}
Sankar V
  • 4,110
  • 5
  • 28
  • 52
  • but this just for Backend editing, right? I want it to be hidden by default for a new frontend entry. solved it for now by setting the following line in the ext_tables.sql: `hidden tinyint(4) unsigned DEFAULT '1' NOT NULL,` – Daniel Schönherr Feb 27 '13 at 15:32
  • If you use the above tsconfig code, then new content elements will be hidden by default. That is you need to unhide the content element after creating it. I think it is a better solution that what you did. – Sankar V Feb 27 '13 at 15:44