DWC is our highly optimised custom development framework based on industry standard Object Oriented Programming PHP. The abstraction layer programming allows DWC to be quickly deployed for any type of business data Content Management System (CMS) while maintaining the highest possible level of integration between the data sets.
At it’s core, DWC allows us to edit and manage any content type (CT) and the required fields through a single file named ‘customPages.inc’
Following is the syntax for a Book CT with multiple fields and 3 language options: English, French & Spanish.
// Books
$books = new CustomPage ('book','Book');
$books->setPrefixURL(array(
'en_US' => 'books',
'fr_FR' => 'books',
'es_SP' => 'books'
));
$books->setURLWithIDs(true);
$books->setTemplate('books', false);
$books->addField('titletranscription', 'Title transcription (English reference)', 'text', false);
$books->addField('condition', 'Book Condition', 'text', false);
$books->addField('artists', 'Artist(s)', 'text', false);
$books->addField('authors', 'Author(s)', 'text', false);
$books->addField('editor', 'Editor(s)', 'text', false);
$books->addField('translators', 'Translator(s)', 'text', false);
$books->addField('publisher', 'Publisher/City', 'string', false);
$books->addField('publicationDate', 'Publication Date', 'string', false);
$books->addField('nationality', 'Nationality', 'string', false);
$books->addField('librarycode', 'Library Coding Reference', 'string', false);
$books->addField('isbn', 'ISBN', 'string', false);
$books->addField('availablequantity', 'Available Quantity', 'integer', false);
$books->addField('location', 'Book Location', 'string', false);
$books->addField('affiliatelink', 'Affiliate link', 'string', false);
$books->addField('authorstaff', 'Staff ID', 'integer', false, true);
$books->addField('updatedts', 'Last Updated (display)', 'datetime', false);
The function is:
function addField($fieldKey, $fieldLabel, $fieldType = 'string', $translatable = false, $hidden = false)
$fieldKey is the name of the field, as it will be stored on the database and then accessible through the extra fields object.
$fieldLabel is the field label on the edit form (above the input)
$fieldType is the field type, which can be one of: ‘string’, ‘integer’, ‘double’, ‘geo’, ‘text’, ‘html’, ‘date’, ‘datetime’, ‘time’, ‘image’, ‘file’, ‘media’, ‘file_other’, ‘dimensiongroup’, ‘addressgroup’
$translatable parameter (first boolean) indicates whether that field is translatable or not. Translatable fields are grouped together with the main text body on the translation tabs.
$hidden (second boolean) indicates a hidden field <input type=”hidden”> This has been added to support fields that are somehow calculated by javascript on the edit form, yet have their data stored as one of the standard field types.