type = $type;
$this->name = $name;
$this->label = $label;
$this->description = $description;
$this->options = $options;
$this->args = $args;
add_filter( 'calla_elated_user_fields', array( $this, 'addFieldForEditSave' ) );
}
public function addFieldForEditSave( $names ) {
$names[] = $this->name;
return $names;
}
public function render( $factory ) {
$factory->render( $this->type, $this->name, $this->label, $this->description, $this->options, $this->args );
}
}
abstract class CallaElatedUserFieldType {
abstract public function render( $name, $label = "", $description = "", $options = array(), $args = array() );
}
class CallaElatedUserFieldText extends CallaElatedUserFieldType {
public function render( $name, $label = "", $description = "", $options = array(), $args = array() ) {
$value = get_user_meta( $_GET['user_id'], $name, true );
?>
children = array();
$this->title = $title_label;
$this->description = $description;
}
public function hasChidren() {
return (count($this->children) > 0)?true:false;
}
public function getChild($key) {
return $this->children[$key];
}
public function addChild($key, $value) {
$this->children[$key] = $value;
}
public function render($factory) { ?>
title); ?>
children as $child) {
$this->renderChild($child, $factory);
} ?>
render($factory);
}
}
class CallaElatedUserFieldFactory {
public function render( $field_type, $name, $label = "", $description = "", $options = array(), $args = array(), $hidden = false ) {
switch ( strtolower( $field_type ) ) {
case 'text':
$field = new CallaElatedUserFieldText();
$field->render( $name, $label, $description, $options, $args, $hidden );
break;
case 'select':
$field = new CallaElatedUserFieldSelect();
$field->render( $name, $label, $description, $options, $args, $hidden );
break;
case 'image':
$field = new CallaElatedUserFieldImage();
$field->render( $name, $label, $description, $options, $args, $hidden );
break;
default:
break;
}
}
}