Currently there is no easy way to export and import settings for items.
The features module seems to be the best way atm.

I am trying to do this with an array and without getting the taxonomy tree I get an error in the admin form. To stop this can we change the isset to empty?

//line 130 of cctags.admin.inc
--   '#default_value' => (isset($item['item_data']['vocs']))?$item['item_data']['vocs'][$key]:FALSE,
++  '#default_value' => (empty($item['item_data']['vocs']))?$item['item_data']['vocs'][$key]:FALSE,

Then this should will work without errors.

function save_new_cctags_item ($settings) {
    $item       = array ();
    $block_name = array ();

    $page_path  = $settings[ 'page_path' ];
    $page_title = check_plain ( $settings[ 'page_title' ] );
    $fields     = array (
        'name'             => check_plain ( $settings[ 'name' ] ) ,
        'block'            => $settings[ 'block' ] ,
        'block_name'       => $settings['block_name'] ,
        'page'             => $settings[ 'page' ] ,
        'page_title'       => $page_title ,
        'page_path'        => $page_path ,
        'page_level'       => $settings[ 'page_level' ] ,
        'page_amount'      => $settings[ 'page_amount' ] ,
        'page_sort'        => $settings[ 'page_sort' ] ,
        'page_mode'        => $settings[ 'page_mode' ] ,
        'page_vocname'     => $settings[ 'page_vocname' ] ,
        'page_extra_class' => $settings[ 'page_extra_class' ] ,
        'item_data'        => serialize ( $settings['item_data'] ) ,
    );
    $cctid      = db_insert ( 'cctags' )->fields ( $fields )->execute ();
    if ( empty( $page_path ) && $settings[ 'page' ] ) {
        $page_path = 'cctags/page/' . $cctid;
        db_update ( 'cctags' )
            ->fields (
            array (
                'page_path' => $page_path ,
            )
        )
            ->condition ( 'cctid' , $cctid )
            ->execute ();
    }
    drupal_set_message ( t ( 'The Cctags item %name has been created.' , array ( '%name' => check_plain ( $settings[ 'name' ] ) ) ) );

    _cctags_clear_cache ( $cctid , 'all' );
    menu_rebuild();
    return $cctid;
}

$test = array (
    'cctid'            => 4 ,
    'name'             => 'tags' ,
    'block'            => 1 ,
    'block_name'       => 'Tags' ,
    'page'             => 0 ,
    'page_title'       => '' ,
    'page_path'        => '' ,
    'page_level'       => 5 ,
    'page_amount'      => 0 ,
    'page_sort'        => 'title,asc' ,
    'page_mode'        => 'mixed' ,
    'page_vocname'     => 0 ,
    'page_extra_class' => '' ,
    'item_data'        => array (
        'vocs'  => array (
//use your own vocab ids here with a 1 to enable
            3 => 1 ,
        ) ,
        'level' => array (
//use your own vocab ids levels here
            3 => array (
                0 => 1 ,
            ) ,
        ) ,
    ) ,
);

save_new_cctags_item ($test );

Comments

imp7’s picture

Issue summary: View changes

edit

imp7’s picture

alexweber’s picture

It would be really nice to have this exported in a feature.

alison’s picture

+1 !!!!!!

alison’s picture

Issue summary: View changes

vocabs comment

astonvictor’s picture

Status: Active » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks