RCCWP_WritePostPage::DropdownListInterface PHP Method

DropdownListInterface() public static method

public static DropdownListInterface ( $customField, $inputName, $groupCounter, $fieldCounter )
    public static function DropdownListInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $mf_domain;
        $customFieldId = '';
        $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']);
        $defClass = '';
        if (isset($mf_post_id)) {
            $customFieldId = $customField->id;
            $value = esc_attr(RCCWP_CustomField::GetCustomFieldValues(true, $mf_post_id, $customField->name, $groupCounter, $fieldCounter));
        } else {
            $defClass = "mf-default";
            $value = $customField->default_value[0];
        }
        $requiredClass = "";
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        ?>
		<div class="mf_custom_field <?php 
        echo $defClass;
        ?>
">
		<select tabindex="3" <?php 
        if ($customField->required_field) {
            echo 'validate="required:true"';
        }
        ?>
 class="<?php 
        echo $requiredClass;
        ?>
 listbox_mf" name="<?php 
        echo $inputName;
        ?>
">
			<option value=""><?php 
        _e('--Select--', $mf_domain);
        ?>
</option>
		
		<?php 
        foreach ($customField->options as $option) {
            $selected = esc_attr($option) == $value ? 'selected="selected"' : '';
            $option = esc_attr(trim($option));
            ?>
			<option value="<?php 
            echo $option;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $option;
            ?>
</option>
		<?php 
        }
        ?>
		
		</select>	</div>
		<?php 
        if ($customField->required_field) {
            ?>
			<div class="mf_message_error"><label for="<?php 
            echo $inputName;
            ?>
" class="error_magicfields error"><?php 
            _e("This field is required", $mf_domain);
            ?>
</label></div>
		<?php 
        }
    }

Usage Example

Exemplo n.º 1
0
    function GetModuleSettings($blockID)
    {
        require_once "RCCWP_WritePostPage.php";
        // Retieve the settings for $blockID
        $moduleSettings = FlutterLayoutBlock::GetModuleSettingsByBlock($blockID);
        foreach ($moduleSettings->variables as $variable) {
            $variable->properties = array();
            $inputName = $variable->variable_name;
            $variableValue = $variable->value;
            ?>
					<label for="item3" class="checkbox"><?php 
            echo $variable->description;
            ?>
					<?php 
            switch ($variable->type) {
                case 'textbox':
                    $variable->properties['size'] = "";
                    RCCWP_WritePostPage::TextboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'multiline_textbox':
                    $variable->properties['height'] = "10";
                    $variable->properties['width'] = "10";
                    RCCWP_WritePostPage::MultilineTextboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'checkbox':
                    RCCWP_WritePostPage::CheckboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'checkbox_list':
                    //$variableValue = unserialize($variableValue);
                    RCCWP_WritePostPage::CheckboxListInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'radiobutton_list':
                    RCCWP_WritePostPage::RadiobuttonListInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'dropdown_list':
                    RCCWP_WritePostPage::DropdownListInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'listbox':
                    //$variableValue = unserialize($variableValue);
                    $variable->properties['size'] = "";
                    RCCWP_WritePostPage::ListboxInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'file':
                    RCCWP_WritePostPage::FileInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'image':
                    RCCWP_WritePostPage::PhotoInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'date':
                    $variable->properties['format'] = "m.d.y";
                    RCCWP_WritePostPage::DateInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
                case 'audio':
                    RCCWP_WritePostPage::AudioInterface($variable, $inputName, 0, 0, $variableValue);
                    break;
            }
            ?>
				</label>
			<?php 
        }
    }
All Usage Examples Of RCCWP_WritePostPage::DropdownListInterface