Hi,
Thanks for your answer but that doesn't seem to work.
I have an access field i try to modify
elgg_view_field([
'#type' => 'access',
'#label' => elgg_echo('access'),
'name' => 'access_id',
'value' => $vars['access_id'],
]);
I have created a hook, but $params["entity_type"] and $params["entity_subtype"] are always NULL, so i can not check if it is the right entity i want to modify authorisations to.
elgg_register_plugin_hook_handler('access:collections:write', 'user', 'myhook'); function myhook($hook, $type, $return_value, $params) { var_dump(
$params); return $return_value; }
I've tried to change the input manually with the code bellow but the public autorisation is still in the list with the message "Missing access level name" (when i create a new entity)
$visibility_options = get_write_access_array();
unset($visibility_options[ACCESS_PUBLIC]);
echo elgg_view_field([
'#type' => 'access',
'#label' => elgg_echo('access'),
'name' => 'access_id',
'value' => $vars['access_id'],
'options_values' => $visibility_options,
]);
Do you have an idea ?
if you don't provide the input/access with entity_subtype and/or entity_type the hook will not magically get that information.
Look at https://github.com/Elgg/Elgg/blob/master/views/default/input/access.php
Ok, thanks !
You are reinventing the wheel, there are already several plugins that allow you to create entity covers: https://github.com/hypejunction/hypeicons
But to answer your question, you can't display a cover image using elgg_view_entity_icon().
echo elgg_view('output/img', [ 'src' => $entity->getIconURL('large', 'cover_image'), ]);
Thanks, that works perfectly !
do you know if there is a specific hook to unregister default fields ?
Should work with the same plugin hook:
function my_custom_profile_fields_handler($hook, $type, $return_value, $params) {
// Following array contains the profile fields that should NOT(!!) be used
// As example all default fields listed here - remove the WANTED fields from the array
$profile_defaults_to_remove = array (
'description' => 'longtext',
'briefdescription' => 'text',
'location' => 'location',
'interests' => 'tags',
'skills' => 'tags',
'contactemail' => 'email',
'phone' => 'text',
'mobile' => 'text',
'website' => 'url',
'twitter' => 'text',
);
// Array of profile fields to be used
$my_profile_fields = array();
// First remove the unwanted fields
foreach($return_value as $name => $type) {
if (!array_key_exists($name, $profile_defaults_to_remove)) {
$my_profile_fields[$name] = $type;
}
}
// Now add custom fields
// Types of fields: 'text', 'longtext', 'tags', 'url', 'email', 'location', 'date'
// Add to language file(s) strings for the field label(s) like 'profile:my_first_custom_profile_field' => "Label for my first custom field",
$my_profile_fields['my_first_custom_profile_field'] = 'text';
$my_profile_fields['my_second_custom_profile_field'] = 'longtext';
return $my_profile_fields;
}
Thanks !
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.