本文整理汇总了PHP中RGFormsModel::flush_current_forms方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::flush_current_forms方法的具体用法?PHP RGFormsModel::flush_current_forms怎么用?PHP RGFormsModel::flush_current_forms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::flush_current_forms方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duplicate_notification
public static function duplicate_notification($notification_id, $form_id)
{
if (!$form_id) {
return false;
}
$form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id;
$new_notification = $form['notifications'][$notification_id];
$name = rgar($new_notification, "name");
$new_id = uniqid();
$count = 2;
$new_name = $name . " - Copy 1";
while (!self::is_unique_name($new_name, $form['notifications'])) {
$new_name = $name . " - Copy {$count}";
$count++;
}
$new_notification["name"] = $new_name;
$new_notification["id"] = $new_id;
$form['notifications'][$new_id] = $new_notification;
// clear Form cache so next retrieval of form meta will return duplicated notification
RGFormsModel::flush_current_forms();
return RGFormsModel::save_form_notifications($form['id'], $form['notifications']);
}
示例2: duplicate_notification
public static function duplicate_notification($notification_id, $form_id)
{
if (!$form_id) {
return false;
}
$form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id;
$new_notification = $form['notifications'][$notification_id];
$name = rgar($new_notification, 'name');
$new_id = uniqid();
$count = 2;
$new_name = $name . ' - Copy 1';
while (!self::is_unique_name($new_name, $form['notifications'])) {
$new_name = $name . " - Copy {$count}";
$count++;
}
$new_notification['name'] = $new_name;
$new_notification['id'] = $new_id;
unset($new_notification['isDefault']);
if ($new_notification['toType'] == 'hidden') {
$new_notification['toType'] = 'email';
}
$form['notifications'][$new_id] = $new_notification;
// clear Form cache so next retrieval of form meta will return duplicated notification
RGFormsModel::flush_current_forms();
return RGFormsModel::save_form_notifications($form['id'], $form['notifications']);
}
示例3: delete_confirmation
/**
* Delete a form confirmation by ID.
*
* @param mixed $confirmation_id
* @param mixed $form_id Can pass a form ID or a form object
*
* @return mixed The result of the database operation
*/
public static function delete_confirmation($confirmation_id, $form_id)
{
if (!$form_id) {
return false;
}
$form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id;
do_action('gform_pre_confirmation_deleted', $form['confirmations'][$confirmation_id], $form);
unset($form['confirmations'][$confirmation_id]);
// clear form cache so next retrieval of form meta will reflect deleted notification
RGFormsModel::flush_current_forms();
return RGFormsModel::save_form_confirmations($form['id'], $form['confirmations']);
}
示例4: delete_confirmation
/**
* Delete a form confirmation by ID.
*
* @param mixed $confirmation_id
* @param mixed $form_id Can pass a form ID or a form object
*
* @return mixed The result of the database operation
*/
public static function delete_confirmation($confirmation_id, $form_id)
{
if (!$form_id) {
return false;
}
$form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id;
/**
* Fires right before the confirmation that a form is deleted
*
* @param int $form['confirmations'][ $confirmation_id ] The delete confirmation object ID
* @para array $form The Form object to filter through
*/
do_action('gform_pre_confirmation_deleted', $form['confirmations'][$confirmation_id], $form);
unset($form['confirmations'][$confirmation_id]);
// clear form cache so next retrieval of form meta will reflect deleted notification
RGFormsModel::flush_current_forms();
return RGFormsModel::save_form_confirmations($form['id'], $form['confirmations']);
}