Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**¬
- * Implements hook_block_view().¬
- */¬
- function hello_world_block_view($delta = '') {¬
- ▸ $block = array();¬
- ▸ ▸ switch($delta) {¬
- ▸ ▸ ▸ case 'hello_world';¬
- ▸ ▸ ▸ ▸ ▸ $links_query =·¬
- ▸ ▸ ▸ ▸ ▸ ▸ "select node.title as node_title, node.nid as nid¬
- ▸ ▸ ▸ ▸ ▸ ▸ from {node} node¬
- ▸ ▸ ▸ ▸ ▸ ▸ left join (select td.*, tn.nid AS nid¬
- ▸ ▸ ▸ ▸ ▸ ▸ from {taxonomy_term_data} td¬
- ▸ ▸ ▸ ▸ ▸ ▸ left join {taxonomy_vocabulary} tv on td.vid = tv.vid¬
- ▸ ▸ ▸ ▸ ▸ ▸ left join {taxonomy_index} tn on tn.tid = td.tid¬
- ▸ ▸ ▸ ▸ ▸ ▸ where (tv.machine_name in ('sections')) ) taxonomy_term_data_node ON node.nid = taxonomy_term_data_node.nid¬
- ▸ ▸ ▸ ▸ ▸ ▸ inner join {field_data_field_enabled} taxonomy_term_data_node__field_data_field_enabled on taxonomy_term_data_node.tid = taxonomy_term_data_node__field_data_field_enabled.entity_id and (taxonomy_term_data_node__field_data_field_enabled.entity_type = 'taxonomy_term' and taxonomy_term_data_node__field_data_field_enabled.deleted = '0')¬
- ▸ ▸ ▸ ▸ ▸ ▸ where (( (node.status = '1') and (node.type in ('hello_world_article')) AND (taxonomy_term_data_node__field_data_field_enabled.field_enabled_value = '1') ))";¬
- ▸ ▸ ▸ ▸ ▸ $links_query_results = db_query($links_query);¬
- ▸ ▸ ▸ ▸ ▸ ▸ if ($links_query_results) {¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ dpm($links_query_results);¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ $block_content = '';¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ while ($row = $links_query_results->fetchAssoc()) {¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ ▸ $block_content .= '<div class="hello_world_link">';¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ ▸ $block_content .= l($row['node_title'], 'node/'.$row['nid']);¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ ▸ $block_content .= '</div>';¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ ▸ $rows[] = $row;¬
- ▸ ▸ ▸ ▸ ▸ ▸ ▸ }¬
- ▸ ▸ ▸ ▸ ▸ ▸ }¬
- ▸ ▸ ▸ ▸ ▸ ▸ $variables = array();¬
- ▸ ▸ ▸ ▸ ▸ ▸ $block['subject'] = t('Hello World!');¬
- ▸ ▸ ▸ ▸ ▸ ▸ $block['content'] = $block_content;¬
- ▸ ▸ ▸ break;¬
- ▸ ▸ ▸ ▸ }¬
- ▸ return $block;¬
- ▸ ▸ }¬
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement