/** * @param FORM $form The form to which these commands belong. * @param string $field_name The name of the field to select/de-select. */ public function __construct($form, $field_name) { $this->assert(isset($form), "[form] cannot be empty.", '__construct', 'SELECTION_COMMANDS'); parent::__construct($form->context); $ctrl_name = $form->js_name($field_name); $command = $this->app->make_command(); $command->id = 'select_all'; $command->caption = 'Select all'; $command->link = '#'; $command->executable = true; $command->on_click = "select_all ({$ctrl_name})"; $this->append($command); $command = $this->app->make_command(); $command->id = 'select_none'; $command->caption = 'Select none'; $command->link = '#'; $command->executable = true; $command->on_click = "select_none ({$ctrl_name})"; $this->append($command); }