public function categories($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('name' => 'category', 'deselect' => true, 'selected' => $config->category, 'prompt' => '- Select -', 'table' => '', 'parent' => '', 'max_depth' => 9));
     if ($config->deselect) {
         $options[] = $this->option(array('label' => $this->translate($config->prompt), 'value' => 0));
     }
     $categories = $this->getObject('com:categories.model.categories')->table($config->table)->parent($config->parent)->sort('title')->getRowset();
     $iterator = new DatabaseIteratorNode($categories);
     $iterator->setMaxDepth($config->max_depth);
     foreach ($iterator as $category) {
         $title = substr('---------', 0, $iterator->getDepth()) . $category->title;
         $options[] = $this->option(array('label' => $title, 'value' => $category->id));
     }
     $config->options = $options;
     return $this->optionlist($config);
 }