Пример #1
0
* Toggle metadata view
*
* @package profile_manager
* @author ColdTrick IT Solutions
* @copyright Coldtrick IT Solutions 2009
* @link http://www.coldtrick.com/
*/
$entity = $vars['entity'];
$metadata_type = $entity->metadata_type;
$metadata_name = $vars['metadata_name'];
$types = array();
$type_options = array();
if ($entity->getSubType() == CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE) {
    $types = profile_manager_get_custom_field_types("custom_profile_field_types");
} elseif ($entity->getSubType() == CUSTOM_PROFILE_FIELDS_GROUP_SUBTYPE) {
    $types = profile_manager_get_custom_field_types("custom_group_field_types");
}
if (!empty($metadata_type) && !empty($types) && array_key_exists($metadata_type, $types)) {
    $type_options = $types[$metadata_type]->options;
}
$id = $metadata_name . "_" . $entity->guid;
$class = "";
$onclick = "";
// if no option is available in the register, this metadata field can't be toggled
if (!empty($type_options) && array_key_exists($metadata_name, $type_options) && $type_options[$metadata_name]) {
    if ($entity->{$metadata_name} != "yes") {
        $class = " field_config_metadata_option_disabled";
    } else {
        $class = " field_config_metadata_option_enabled";
    }
    $title = elgg_echo('profile_manager:admin:' . $metadata_name);
Пример #2
0
* @copyright Coldtrick IT Solutions 2009
* @link http://www.coldtrick.com/
*/
if (!elgg_is_admin_logged_in()) {
    echo elgg_echo('adminrequired');
    return;
}
$guid = (int) get_input('guid');
$entity = get_entity($guid);
if (!$entity instanceof \ColdTrick\ProfileManager\CustomField) {
    $entity = null;
}
$form_title = elgg_echo('profile_manager:profile_fields:add');
$options_values = [];
$option_classes = [];
$types = profile_manager_get_custom_field_types('custom_profile_field_types');
if ($types) {
    foreach ($types as $type) {
        $options_values[$type->type] = $type->name;
        foreach ($type->options as $option_name => $option_value) {
            if ($option_value) {
                $option_classes[$option_name] .= ' field_option_enable_' . $type->type;
            }
        }
    }
}
$metadata_name = null;
$metadata_label = null;
$metadata_input_label = null;
$metadata_hint = null;
$metadata_placeholder = null;