DADA::ProfileFieldsManager

NAME

DADA::ProfileFieldsManager

SYNOPSIS

DESCRIPTION

Public Methods

new

 my $pfm = DADA::ProfileFieldsManager->new

new requires no parameters.

A DADA::ProfileFieldsManager object will be returned.

fields

 my $fields = $pfm->fields; 

fields returns an array ref of the names of the columns that represent the Profile Fields currently created.

fields returns the fields in the order they are usually stored in the SQL table.

fields requires no parameters.

add_field

 $pfm->add_field(
        {
                -field          => 'myfield', 
                -fallback_value => 'a default', 
                -label          => 'My Field!', 
        }
 ); 

add_field() adds a field to the profile_fields table.

-field is a required parameter and should be the name of the field you want to create. This field has to be a valid column name for whatever backend you're using. It's suggested that you stick with lowercase, less than 16 character names.

Not passing a name for your field in the -field parameter will cause the an unrecoverable error.

-fallback_value is an optional parameter, it's a more free form value, used when the profile does not have a value for this profile field. This is usually used in templating

-label is an optional parameter and is used in forms that capture Profile Fields information as a, "friendlier" version of the field name.

This method will return undef if there's a problem with the parameters passed. See also the, validate_subscriber_field_name() method.

save_field_attributes

 $pfm->save_field_attributes(
        {  
                -field                  => 'myfield', 
                -fallback_value => 'a default', 
                -label          => 'My Field!',
        }
 );

Similar to add_field(), save_field_attributes() saves the fallback value and label for a field. It will not create a new field, but will error if you attempt to save a field attribute to a field that does not exist.

edit_subscriber_field_name

        $pfm->edit_subscriber_field(
                {
                        -old_name => 'myfield' ,
                        -new_name => 'mynewname',
                }
        );      
        

edit_subscriber_field_name() is used to rename a subscriber field. Usually, this means that a column is renamed in table. Various SQL backends do this differently and this method should provide the necessary magic.

-old_name and -new_name are required parameters and the method will croak if you do not pass both.

This method will also croak if either the -old_name does not exist, or the -new_name exists.

remove_field

 $pfm->remove_field(
        { 
                -field => 'myfield', 
        }
 ); 

remove_field will remove the profile field passed in, -field.

-field must exist, or the method will croak.

change_field_order

 $pfm->change_field_order(
        {
                -field     => 'myfield', 
                -direction => 'down', # or, 'up' 
        }
 );

change_field_order is used to change the ordering of the Profile Fields. Profile Fields are usually in the order as they are stored in the SQL table and this method actually changes that order itself.

This method is not available for the SQLite or PostgreSQL backend.

-field should hold the name of the field you'd like to move.

-direction should be either up or, <down> to denote which direction you'd like the field to be moved. Movements are not circular - if you attempt to push a field down and the field is already the last field, it'll stay the last field and won't pop to the top of the stack.

This method should return, 1, but if a field cannot be moved, it will return, 0

This method will also croak if you pass a field that does not exist, or if you pass no field at all.

AUTHOR

Justin Simoni https://dadamailproject.com

LICENSE AND COPYRIGHT

Copyright (c) 1999 - 2023 Justin Simoni All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Dada Mail Project

Download

Installation

Support