function __construct() { global $wgRequest, $wgTitle; parent::__construct('CreateFromTemplate', '', true); $bits = explode('/', $wgTitle->getDBkey(), 2); if (!empty($bits[1])) { $this->mType = $bits[1]; } else { $this->mType = $wgRequest->getText('type'); } // setup list of fields for recipe form $key = "recipes-template-{$this->mType}-fields"; $fieldsRaw = wfMsgForContent($key); // if ( wfMsgEmpty( $key, $fieldsRaw ) ) { // return null; // } $this->mFields = array(); $parent = ''; $fieldsRaw = explode("\n", $fieldsRaw); foreach ($fieldsRaw as $row) { if (strpos($row, '* ') === 0) { $row = trim($row, '* '); $this->mFields[$row] = array(); $parent = $row; } elseif (strpos($row, '** ') === 0) { $row = trim($row, '** '); $row = explode('|', $row); $row[1] = $row[1] === 'true' ? true : $row[1]; $row[1] = $row[1] === 'false' ? false : $row[1]; $this->mFields[$parent][$row[0]] = $row[1]; } // other cases are ignored } }
function __construct() { parent::__construct('CreateRecipe', '', true); // setup list of fields for recipe form $this->mFields = array('wpTitle' => array('type' => 'input', 'label' => 'title', 'hint' => 'title', 'hintHideable' => true, 'required' => true, 'noToolbar' => true), 'wpIngredients' => array('type' => 'multifield', 'label' => 'ingredients', 'hint' => 'ingredients', 'hintHideable' => true, 'required' => true), 'wpDirections' => array('type' => 'textarea', 'label' => 'directions', 'hint' => 'directions', 'hintHideable' => true, 'required' => true), 'wpPrepTime' => array('type' => 'time', 'label' => 'prep-time'), 'wpCookTime' => array('type' => 'time', 'label' => 'cook-time'), 'wpYields' => array('type' => 'input', 'label' => 'yields', 'hint' => 'yields', 'hintHideable' => true), 'wpDescription' => array('type' => 'textarea', 'label' => 'description', 'hint' => 'description', 'hintHideable' => true), 'wpPhoto' => array('type' => 'upload', 'label' => 'photo', 'default' => 'Image:Placeholder'), array('type' => 'heading', 'label' => 'kind-of-recipe-heading', 'editLink' => 'recipe-menus'), 'wpCategories' => array('type' => 'multiselect', 'values' => 'recipe-menus', 'required' => true)); }
function __construct() { parent::__construct('CreateIngredient', '', true); // setup list of fields for recipe form $this->mFields = array('wpTitle' => array('type' => 'input', 'label' => 'title', 'required' => true, 'noToolbar' => true), 'wpDescription' => array('type' => 'textarea', 'label' => 'description', 'hint' => 'ingredient-description'), 'wpBuying' => array('type' => 'textarea', 'label' => 'buying', 'hint' => 'buying'), 'wpProduction' => array('type' => 'textarea', 'label' => 'production', 'hint' => 'production'), 'wpPreparation' => array('type' => 'textarea', 'label' => 'preparation', 'hint' => 'preparation'), 'wpNutrition' => array('type' => 'textarea', 'label' => 'nutrition', 'hint' => 'nutrition'), 'wpPhoto' => array('type' => 'upload', 'label' => 'photo', 'default' => 'Image:Placeholder'), array('type' => 'heading', 'label' => 'kind-of-ingredient-heading', 'editLink' => 'ingredient-menus'), 'wpCategories' => array('type' => 'multiselect', 'values' => 'ingredient-menus', 'required' => true)); }