public static function validateRequired($field) { if (is_post() && !\Meta\Core\Form::hasValue($field)) { \Meta\Core\Form::addError(t('There are one or more required field(s)'), $field); } }
if (!\Meta\Core\FileSystem::isDirWritable()) { $cmd = 'sudo chmod 666 ' . \Meta\Core\FileSystem::getFilesPath() . ' -R'; \Meta\Core\Flash::error(t('The files directory is not writable! To set correct permission, type: <br/><b>' . $cmd . '</b>')); } set_page_title(t("Page: {$pageArray['label']}")); // form \Meta\Core\Form::validateRequired('name'); \Meta\Core\Form::validateRequired('label'); $new_name = \Meta\Core\Form::value('name'); // page rename action detect $renamed = false; if (is_post() && $new_name != $path) { $renamed = true; // validate page exists if (isset($pages[$new_name])) { \Meta\Core\Form::addError(t('This page already exists')); } } if (\Meta\Core\Form::hasValidated()) { if (is_demo()) { \Meta\Core\Flash::error(\Meta\Builder::demoMsg()); } else { \Meta\Core\Flash::success(t('Page updated.')); // changes the new page name if ($renamed) { $pages[$new_name] = $pages[$path]; unset($pages[$path]); $path = $new_name; } // atualiza array $page = new \Meta\Builder\Page($path, $pageArray);