You are here

function uma_CFV in User Menu Avatar (User Image in Menu) 8.4

Same name and namespace in other branches
  1. 8.5 user_menu_avatar.module \uma_CFV()

Get our form values.

File

./user_menu_avatar.module, line 34
Display user picture and/or user name in menu.

Code

function uma_CFV() {

  // Get the form config.
  $config = \Drupal::config('user_menu_avatar.user_menu_avatar_settings');

  // Get link text form value.
  $configLinkText = $config
    ->get('link_text_name') ? rtrim(strip_tags($config
    ->get('link_text_name'))) : 'My account';

  // Get show menu avatar form value.
  $showAvatar = $config
    ->get('show_menu_avatar') ?: 'yes';

  // Set the $name value.
  $showName = $config
    ->get('show_menu_name') ?: 'yes';

  // Get avatar shape form value.
  $avatarShape = $config
    ->get('avatar_shape') ?: 'circle';

  // Get avatar size form value.
  $avatarSize = $config
    ->get('avatar_size') ?: 50;

  // Get the avatar image field name form value.
  $imageFieldName = $config
    ->get('avatar_image_field') ?: 'user_picture';

  // Get the custom name field form value.
  $customNameField = $config
    ->get('avatar_custom_name_field') ?: '';
  return [
    'configLinkText' => $configLinkText,
    'showAvatar' => $showAvatar,
    'showName' => $showName,
    'avatarShape' => $avatarShape,
    'avatarSize' => $avatarSize,
    'avatarImageField' => $imageFieldName,
    'customNameField' => $customNameField,
  ];
}