Index: nodefamily.module =================================================================== --- nodefamily.module (revision 645) +++ nodefamily.module (revision 643) @@ -374,12 +374,12 @@ /** * Returns an array of all parent content types for the given child content type */ -function nodefamily_get_parent_types($type = NULL) { +function nodefamily_get_parent_types(&$type) { $relations = variable_get('nodefamily_relations',array()); $parents = array(); - foreach ($relations as $parent => $children) { - if ($type == NULL || in_array($type, array_keys($children))) { + foreach($relations as $parent => $children) { + if (in_array($type, array_keys($children))) { $parents[] = $parent; } } @@ -389,10 +389,10 @@ /** * Returns an array of all child content types for the given parent content type */ -function nodefamily_get_child_types($type = NULL) { +function nodefamily_get_child_types(&$type) { $relations = variable_get('nodefamily_relations',array()); - if ($type == NULL || array_key_exists($type, $relations)) { + if (array_key_exists($type, $relations)) { return array_keys($relations[$type]); } else { @@ -400,6 +400,7 @@ } } + /** * Sets the node-node relation for all parent nodes with the type $parent_type and the * author uid $uid @@ -739,43 +740,8 @@ } } -/** - * @ingroup hook_block implementation - * implementation of hook_block - * @todo make sure we only load lonely nodes - */ -function nodefamily_block($op = 'list', $delta = 0, $edit = array()){ - // The $op parameter determines what piece of information is being requested. - switch ($op) { - case 'list': - foreach (nodefamily_get_parent_types() as $type) { - $blocks[$type]['info'] = t('My nodefamily for %type', array('%type' => node_get_name($type))); - } - return $blocks; - case 'view': default: - $block['subject'] = t('My %type', array('%type' => node_get_name($delta))); - $block['content'] = nodefamily_block_contents($delta); - return $block; - } -} /** - * @ingroup hook_block implementation - * Generate the content for the block - * @todo unhardcode the [] bracketses - */ -function nodefamily_block_contents($type) { - global $user; - $node = node_load(array('type' => $type, 'uid' => $user->uid)); - if ($children = nodefamily_relation_load($node)) { - foreach ($children as $profile) { - $items[] = l($profile->title, 'node/'. $profile->nid) .' ['. l(t('edit'), 'node/'. $profile->nid .'/edit') .']'; - } - return theme('item_list', $items); - } -} - -/** * Views integration */