| 1 |
<?php |
| 2 |
class UWPM_Element { |
| 3 |
|
| 4 |
// the code-friendly name of the element |
| 5 |
public $slug; |
| 6 |
|
| 7 |
// the display name for the element |
| 8 |
public $label; |
| 9 |
|
| 10 |
// the section this element should be displayed in |
| 11 |
public $section; |
| 12 |
|
| 13 |
// the function used to process the element when an email is sent |
| 14 |
public $callback_function; |
| 15 |
|
| 16 |
// optional additional attributes for the element |
| 17 |
public $attributes; |
| 18 |
|
| 19 |
// optional styling added to the output |
| 20 |
public $styling_options; |
| 21 |
|
| 22 |
public function __construct( $element_type, $params = array() ) { |
| 23 |
|
| 24 |
$this->slug = $element_type; |
| 25 |
|
| 26 |
$this->set_props( $params ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Set the key properties for this element type |
| 31 |
* @since 0.0.1 |
| 32 |
*/ |
| 33 |
public function set_props( $params ) { |
| 34 |
|
| 35 |
$defaults = array( |
| 36 |
'label' => $this->slug, |
| 37 |
'section' => 'uncategorized', |
| 38 |
'callback_function' => 'print_r', |
| 39 |
'attributes' => array(), |
| 40 |
'styling_options' => array() |
| 41 |
); |
| 42 |
|
| 43 |
$props = array_merge( $defaults, $params ); |
| 44 |
|
| 45 |
$this->label = $props['label']; |
| 46 |
$this->section = $props['section']; |
| 47 |
$this->callback_function = $props['callback_function']; |
| 48 |
$this->attributes = $props['attributes']; |
| 49 |
$this->styling_options = $props['styling_options']; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
?> |