public function __add_edit_form(Entity $data = NULL) { $entity = $this->getRealEntityInUse(); $fields = SQL::getFields($entity->getDbTableName()); unset($fields['id'], $fields['order'], $fields['active']); $form_params = ['data' => $data, 'action' => '?p=' . P . '&do=_add', 'combine' => 'true', 'button' => __('Add'), 'fields' => $fields]; return CmsFormHelper::outputForm($entity->getDbTableName(), $form_params); }
/** * @param string $module * @param array $fields * @return string */ public static function requireTableForExternalModule($module = P, $fields = []) { $data = new CustomSettingRepository(); $data->setWhereModule($module); $data->getAsArrayOfObjectData(); foreach ($data->getAsArrayOfObjectData() as $key => $field) { // Any existing data if (isset($fields[$field['key']])) { $field = array_merge($fields[$field['key']], $field); } // Supplied data if (!isset($field['module'])) { $field['module'] = P; } $field['title'] = Converter::symb2Ttl($field['key']); $field['type'] = $field['input_type']; $options_array = []; if ($field['input_options'] && is_string($field['input_options'])) { $options_array = json_decode($field['input_options'], JSON_OBJECT_AS_ARRAY); } // Validators and editors if (isset($options_array['editor_wysiwyg'])) { $field['edit'] = 'wysiwyg'; } if (isset($options_array['editor_files'])) { $field['edit'] = 'files'; } if (isset($options_array['editor_pages'])) { $field['edit'] = 'pages'; } if (isset($options_array['require'])) { $field['required'] = true; $field['validate']['require'] = true; } if (isset($options_array['is_digit'])) { $field['validate']['is_digit'] = true; } if (isset($options_array['alphanum'])) { $field['validate']['alphanum'] = true; } if (isset($options_array['url'])) { $field['validate']['url'] = true; } if (isset($options_array['email'])) { $field['validate']['email'] = true; } // Input Type if ($field['input_type'] == 'select') { $field['options'] = ModuleSettings::getSelectTypeSettingOption(P, $field['key']); } $fields[$field['key']] = $field; } if (!$fields) { return false; } $form_array = ['action' => '?p=' . P . '&do=_settings', 'button' => __('Update'), 'fields' => $fields]; return CmsFormHelper::outputForm(self::$tables['settings'], $form_array)->enableAjax(); }
public function __subscribers_form($data = NULL) { $form_array = ['data' => $data, 'button' => 'Update', 'combine' => true, 'fields' => ['ts' => ['name' => 'Date', 'type' => 'datetime'], 'receive_news' => ['type' => 'checkbox'], 'receive_ads' => ['type' => 'checkbox']], 'unset' => ['id', 'user_id']]; return CmsFormHelper::outputForm(ModuleEmailSubscribers::$tables['subscribers'], $form_array); }
private function __tags_add_edit_form($data = NULL) { $tag = new ArticleTagEntity(); return CmsFormHelper::outputForm($tag->getDbTableName(), ['data' => $data, 'button' => __('Add'), 'fields' => ['title' => ['translation' => true]], 'unset' => ['active']]); }
private static function __categories_add_edit_form($data = NULL) { return CmsFormHelper::outputForm(ModuleFaq::$tables['categories'], ['action' => '?p=' . P . '&do=_categories_add', 'button' => 'Add', 'data' => $data, 'fields' => ['title' => ['translation' => true]]]); }
public function __reviews_form($data = NULL) { $form_array = ['data' => $data, 'action' => '?p=' . P . '&do=_add', 'button' => 'Add', 'fields' => ['image' => ['edit' => 'files', 'path' => DIR_IMAGES_URL . 'reviews'], 'name' => ['translation' => true], 'title' => ['translation' => true], 'description' => ['type' => 'textarea', 'translation' => true]]]; return CmsFormHelper::outputForm(ModuleReviews::$tables['reviews'], $form_array); }
public function __setting_options_form($data = NULL) { $id = abs((int) $_GET['id']); if (!$id) { return; } /** @var CustomSetting Option$data */ $form_array = ['title' => $data ? __('Edit option') : __('Add option'), 'data' => $data, 'action' => '?p=' . P . '&do=_setting_options_add', 'button' => 'Add', 'fields' => ['option_name', 'setting_id' => ['type' => 'hidden', 'value' => $id]]]; return CmsFormHelper::outputForm(ModuleSettings::$tables['options'], $form_array); }