function beautytips_manager_get_custom_tips in BeautyTips 8
Same name and namespace in other branches
- 6.2 beautytips_manager.module \beautytips_manager_get_custom_tips()
- 7.2 beautytips_manager.module \beautytips_manager_get_custom_tips()
Retrieve all custom beautytips.
2 calls to beautytips_manager_get_custom_tips()
- BeautytipsManagerController::customTipsOverview in beautytips_manager/
src/ Controller/ BeautytipsManagerController.php - Custom tips administration.
- beautytips_manager_page_attachments in beautytips_manager/
beautytips_manager.module - Implements hook_page_attachments().
File
- beautytips_manager/
beautytips_manager.module, line 151 - Code related to defining and displaying custom beautytips and styles.
Code
function beautytips_manager_get_custom_tips() {
$tips = [];
$cache = \Drupal::cache()
->get('beautytips:beautytips-ui-custom-tips');
if (!$cache) {
$results = \Drupal::database()
->query("SELECT * FROM {beautytips_custom_tips}");
foreach ($results as $result) {
$tips[$result->id] = $result;
}
\Drupal::cache()
->set('beautytips:beautytips-ui-custom-tips', $tips, CacheBackendInterface::CACHE_PERMANENT, [
'beautytips',
]);
}
else {
$tips = $cache->data;
}
return $tips;
}