You are here

function beautytips_manager_save_custom_tip in BeautyTips 8

Same name and namespace in other branches
  1. 6.2 beautytips_manager.module \beautytips_manager_save_custom_tip()
  2. 7.2 beautytips_manager.module \beautytips_manager_save_custom_tip()

Save a singular beautytip.

1 call to beautytips_manager_save_custom_tip()
CustomTipsEditForm::submitForm in beautytips_manager/src/Form/CustomTipsEditForm.php
Form submission handler.

File

beautytips_manager/beautytips_manager.module, line 105
Code related to defining and displaying custom beautytips and styles.

Code

function beautytips_manager_save_custom_tip($tip) {
  $tip = (array) $tip;
  $tip_id = isset($tip['id']) && $tip['id'] ? $tip['id'] : NULL;
  \Drupal::database()
    ->merge('beautytips_custom_tips')
    ->key([
    'id' => $tip_id,
  ])
    ->fields($tip)
    ->execute();
  return $tip;
}