function word_link_get_link in Word Link 8
Same name and namespace in other branches
- 7 word_link.module \word_link_get_link()
Get links from DB.
5 calls to word_link_get_link()
- word_link_add_form in ./
word_link.admin.inc - Form builder for add or edit page.
- word_link_comment_view in ./
word_link.module - Implements hook_comment_view().
- word_link_exchange_export_form_submit in modules/
word_link_exchange/ word_link_exchange.module - Export for word_link_exchange_export_form.
- word_link_list_page_form in ./
word_link.admin.inc - Buid a Word Link list page.
- word_link_node_view in ./
word_link.module - Implements hook_node_view().
File
- ./
word_link.module, line 299 - This module allows users to replace previously defined words to the links.
Code
function word_link_get_link($id = NULL, $header = array(), $limit = NULL) {
if ($id) {
$query = db_select('word_link', 'wl')
->fields('wl')
->condition('id', $id, '=')
->execute()
->fetchAll();
}
elseif (empty($id) && empty($header) && empty($limit)) {
$query = db_select('word_link', 'wl')
->fields('wl')
->execute()
->fetchAll();
}
else {
$query = db_select('word_link', 'wl')
->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')
->extend('Drupal\\Core\\Database\\Query\\TableSortExtender')
->fields('wl')
->limit($limit)
->orderByHeader($header)
->execute()
->fetchAll();
}
$links = array();
if (count($query) > 0) {
foreach ($query as $value) {
$links[$value->id] = $value;
}
}
return $links;
}