Extended ElggGroup

I have the expression that we do not understand what I want since, but I would say it again more slowly. We all know that an ElggGroup with two attributes that are name and description. Good now when add new attributes to my extended object. where should I store these new attributes? in addition to that when I create a new object of the type of the extended object. he does not appear in the place. that I want and not rather appear in those of groups. which is also an extended object. Please, remember that the blog plugin can not help me. I need your help

  • when add new attributes to my extended object. where should I store these new attributes?

    Just register actions and make forms for it.

  • it's done: look here and the action file edit is in my previous post: 

    <?php
    /**
     *  Project edit form 
     *  This view contains the CamerProject profile field configuration
     *
     *  @package ElggGroups
     */
    
    //$camerproject_profile_fields = elgg_get_config("project");
    
    /* @var $entity Camerproject */
    $entity = elgg_extract('entity', $vars);
    
    $progress = project_get_progress();
    
    if ($entity instanceof Camerproject) {
        
        echo elgg_view_field([
                '#type' => 'hidden',
                'name' => 'project_guid',
                'value' => $entity->guid,
        ]);
    }
    
    // title
    echo elgg_view_field([
        '#type' => 'text',
        '#label' => elgg_echo('camerproject:title'),
        'name' => 'name',
        'value' => elgg_extract('name', $vars),
        'required' => true,
    ]);
    
    // icon
    // Get post_max_size and upload_max_filesize
    $post_max_size = elgg_get_ini_setting_in_bytes('post_max_size');
    $upload_max_filesize = elgg_get_ini_setting_in_bytes('upload_max_filesize');
    
    // Determine the correct value
    $upload_limit = $upload_max_filesize > $post_max_size ? $post_max_size : $upload_max_filesize;
    $upload_limit = elgg_format_bytes($upload_limit);
    
        echo elgg_view_field([
          '#type' => 'file',
          '#label' => elgg_echo('camerproject:logoproject'),
          '#help' => elgg_echo('camerproject:edit:icon:limit', [$upload_limit]),
          'name' => 'icon',
          'value' => elgg_extract('icon', $vars),
          'required' => true,
        ]);
     
     echo elgg_view_field([
         '#type' => 'plaintext',
         '#label' => elgg_echo('camerproject:summery'),
         'name' => 'description',
         'value' => elgg_extract('description', $vars),
         'required' => true,
     ]);
    
     echo elgg_view_field([
         '#type' => 'dropdown',
         '#label' => elgg_echo('camerproject:progress'),
         'name' => 'progress',
         'options_values' => $progress,
         'value' => elgg_extract('progress', $vars),
         'required' => true,
      ]);
    
      echo elgg_view_field([
         '#type' => 'sectorindustry',
         '#label' => elgg_echo('camerproject:industry'),
         'name' => 'sectorindustry',
         'value' => elgg_extract('sectorindustry', $vars),
         'required' => true,
         'data-rel' => 'sectorindustry',
        ]);
    
      echo elgg_view_field([
         '#type' => 'select',
         '#label' => elgg_echo('camerproject:activity'),      
         'name' => 'activity',
         'value' => elgg_extract('activity', $vars),
         'options_values' => [
             'dvpdurable' => elgg_echo('camerproject:activity:dvpdurable'),
             'ecosociale' => elgg_echo('camerproject:activity:ecosociale'),
             'ong' => elgg_echo('camerproject:activity:ong'),
             'sanspreference' => elgg_echo('camerproject:activity:sanspreference'),
         ]
       ]);
    
     echo elgg_view_field([
         '#type' => 'select',
         '#label' => elgg_echo('camerproject:markettype'),
         'name' => 'markettype',
         'value' => elgg_extract('markettype', $vars),
         'required' => true,
         'options_values' => [
             'clientsentreprise' => elgg_echo('camerproject:markettype:cliententreprise'),
             'clientparticulier' => elgg_echo('camerproject:markettype:clientparticulier'),
         ]
         
     ]);
     
     echo elgg_view_field([
         '#type' => 'select',
         'name' => 'typemark',
         'value' => elgg_extract('typemark', $vars),
         'required' => true,
         'options_values' => [
             'local' => elgg_echo('camerproject:typermark:local'),
             'afrique' => elgg_echo('camerproject:typermark:afrique'),
             'europe' => elgg_echo('camerproject:typermark:europe'),
             'international' => elgg_echo('camerproject:typermark:international'),
             'amerique' => elgg_echo('camerproject:typermark:amerique'),
             'asie'  => elgg_echo('camerproject:typermark:asie'),
             'moyenorient' => elgg_echo('camerproject:typermark:moyenorient'),
         ],
     ]);
    
    echo elgg_view_field([
         '#type' => 'select',
         '#label' => elgg_echo('camerproject:offertype'),
         'name' => 'offertype',
         'value' => elgg_extract('offertype', $vars),
         'options_values' => [
             'produits' => elgg_echo("camerproject:offertype:produits"),
             'services' => elgg_echo("camerproject:offertype:services"),
         ],
         'required' => true, 
     ]);
    
    echo elgg_view_field([
         '#type' => 'select',
         '#label' => elgg_echo('camerproject:turnover'),
         'name' => 'turnover',
         'value' => elgg_extract('turnover', $vars),
         'required' => true,
         'options_values' => [
             'inf2millions' => elgg_echo('camerproject:turnover:inf2millions'),
             'entre2et5millions' => elgg_echo('camerproject:turnover:entre2et5millions'),
             'audelade5millions' => elgg_echo('camerproject:turnover:audelade5millions'),
         ],
     ]);
    
    echo elgg_view_field([
         '#type' => 'devise',
         'name' => 'devise',
         'value' => elgg_extract('devise', $vars),
         'required' => true,
         'data-rel' => 'devise',
     ]);
    
    echo elgg_view_field([
        '#type' => 'location',
        '#label' => elgg_echo('camerproject:location'),
        'name' => 'location',
        'value' => elgg_extract('location', $vars),
        'required' => true,
    ]);
    
    echo elgg_view_field([
        '#type' => 'url',
        '#label' => elgg_echo('camerproject:projectwebsite'),
        'name' => 'projectwebsite',
        'value' => elgg_extract('projectwebsite', $vars),
      
    ]);
    
    echo elgg_view_field([
        '#type' => 'url',
        '#label' => elgg_echo('camerproject:projectblog'),
        'name' => 'projectblog',
        'value' => elgg_extract('projectblog', $vars),
     
    ]);
    
    echo elgg_view_field([
        '#type' => 'url',
        '#label' => elgg_echo('camerproject:projectpitch'),
        'name' => 'projectpitch',
        'value' => elgg_extract('projectpitch', $vars),
      
    ]);
  • Ok. I see. All correct excluding:

    if ($entity instanceof Camerproject) {

    You need to define this class in your form

  •  

    at which level, in addition this class is defined in the folder classs of my plugin

  • Then add this string at the start of your form:

    use \name-of-your-folder-with-classes-where-this-class-is-stored\Camerproject
    
    ...continue of your code
  • Example:

    My class name: Camerproject

    I've stored it in my plugin: /mod/my_cool_plugin/classes/project/Camerproject.php

    Next in all my forms/actions/views etc I can use my class name and its attributes/functions if I'll define it before. E.g.:

    use \project\Camerproject
    $entity = elgg_extract('entity', $vars);
    
    $progress = project_get_progress();
    
    if ($entity instanceof Camerproject) {

    ....