i'm trying to learn a bit about classes in php, and I have created this class
Code:
<?php
class menu_1 {
/*
* variable declarations
*/
public $title;
public $menu;
/*
* block title
*/
function get_title() {
$this->title='STEP 2 - Services you are listed under';
return $this->title;
}
/**
* menu definition
* @param object $user the user object
* @param object $node1 the profile node
* @param object $node2 the bio node
* @return array the defined menu structure
*/
function get_menu($user,$node1,$node2) {
$this->menu=array(
0=>array(
'title'=>'Display Name', //title of link button
'description'=>'description', // description of button target (directions)
'base_path'=>'node/'.$node1->nid.'/edit', //base path of link button target
'object'=>'node1', //object to compare against for completed status
'field'=>'field_display_name', //field to compare against for completion
'query'=>'content_complete_fieldname',
),
);
return $this->menu;
}
}
is this right?
it works, but before I go and dig myself into a hole doing it wrong, i just want to know if i'm doing it right, or if i could do this better.