示例#1
0
<?php

use CCK\ContentAPI;
use CCK\FieldsUI;
# Create FieldsUI Object
$fieldsUI = new FieldsUI($_cck_types, $_cck_config);
# New ContentAPI Object
$_cck_api_content = new ContentAPI($_cck_types, $_cck_config);
# Check for ID
if (isset($_GET['ID']) && is_numeric($_GET['ID'])) {
    # Get Content
    $content = $_cck_api_content->get($_GET, 'Array');
    # If not false, pass to UI.
    if ($content) {
        # The Content
        $theContent = $content[0];
        # Get Type
        if (!$fieldsUI->typeExists($theContent['type'])) {
            add_var('error', '<strong>' . $theContent['type'] . '</strong> is not a valid content type.');
        } else {
            # Type
            $type = $theContent['type'];
            # Pass to UI
            add_var('fields', $fieldsUI->buildForm($type, $theContent));
            add_var('type', $type);
        }
    }
} else {
    header('location: /manage');
}
示例#2
0
<?php

use CCK\FieldsUI;
# Create FieldsUI Object
$fieldsUI = new FieldsUI($_cck_types, $_cck_config);
# Get Type
if (!$fieldsUI->typeExists(cck_get_key('type'))) {
    add_var('error', '<strong>' . cck_get_key('type') . '</strong> is not a valid content type.');
} else {
    # Type
    $type = cck_get_key('type');
    # Pass to Twig
    add_var('fields', $fieldsUI->buildForm($type));
    add_var('type', $type);
    #print_r( get_var('fields') );
}