Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
title/components/modules/my_module/my_module.php
<?php 
class MyModule extends Module { 

    ...

    public function getPackageFields($vars=null) {
        // Create the label
        $fields = new ModuleFields();
        $my_label = $fields->label("My Field Label", "my_field_id");

##
# TODO: FINISH THIS EXAMPLE
#
##		// Create a field label displayed next to the checkbox
		$field_label = $fields->label("My Value", "my_field_my_value_id");

        // Create and attach the field to the label, set as checked (3rd param) if necessary
        $my_label->attach($fields->fieldCheckbox("my_field_name", "my_value", (isset($vars->my_field_name) && $vars->my_field_name == "my_value"), array('id' => "my_field_my_value_id"), $field_label));

        // Attach a tooltip to the label
        $my_label->attach($fields->tooltip("This is my tooltip"));

        $fields->setField($my_label);
        return $fields;
    }
}
?>

...