Page Module - Custom Fields, Not working



  • I have watched the video and followed the instructions to a tee, but I am not seeing the fields show in the edit or create forms.

    What is really strange is it doesn't appear that the Page create/edit screens are using the partial views from itself. When I make any change to Page->Resources->views->admin->partials->create-fields.blade.php directly I don't see the change in the form at all. Even adding a <h1>Hello World</h1> won't display. I can even delete the partials from the Page module admin views and clear all caches and the page still loads with the default form.

    I am slightly mystified by how the create and edit forms load the HTML, I am confident it isn't from views->admin->partials. Which is where the code to look for settings in the config for custom fields lives.

    Any help?



  • Curious about this too....



  • I've brought a working PageExtensions module, from a 2.x version of AsgardCMS I had setup for another project. It does not work anymore in 3.x.

    There is for sure something not aligned in the documentation / video. Does anyone have any insights? Will post if I find anything, but so far no luck.



  • bump

    How can you extend the form views in Page and User modules now that they are all ajaxy with Vue



  • Here's how I added a custom field to the Admin Pages:

    1. console "npm install" at the root of the project
    2. console cd to Themes/Adminlte and "npm install"
    3. create your db migration (I added a field to the page module) and migrate
    4. in the partials for the Page module add your field to edit and create blades
    5. in Modules->Page->Assets->js->components edit the 3 .vue files to add the new field
    6. console cd to root of project "php artisan asgard:module:publish Page"
    7. console cd to Themes/Adminlte and "npm run watch"
    8. console cd to root of project "npm run watch"
    9. house keeping "php artisan cache:clear" and "php artisan view:clear"

    You should now see your field in the create and edit of the backend of your site. Remember to add the translation if the field is translatable.



  • @jdkman Won't this break when/if the Page module is updated?



  • Hello, I have the same question. I found this video

    and when I added my custom fields they were not displayed in the Page Module "create page" page.

    My asgard cms version is 3.5.1
    Laravel version is 5.5.36

    Any idea?
    Anyone can help?



  • @jdkman said in Page Module - Custom Fields, Not working:

    php artisan asgard:module:publish Page

    So, the /config/asgard/page/config.php file currently is useless? It looks it doesn't work.
    I need to put another fields from another module into the page module. How can I do it?


  • admin

    Hello,

    Indeed custom fields are not supported anymore in version 3. This is because v3 uses vuejs.

    In order to add custom fields, you need to remove the page module from composer, but leaving it in git, so that you can freely customise it.



  • @nwidart did you mean to leave it in my repo? Actually I tried to do it and nothing. I removed the module from the composer.json, chenged the vue.js files, ran npm run watch in the two directories and nothing. So, I did everything like you wrote here and nothing:

    console "npm install" at the root of the project
    console cd to Themes/Adminlte and "npm install"
    create your db migration (I added a field to the page module) and migrate
    in the partials for the Page module add your field to edit and create blades
    in Modules->Page->Assets->js->components edit the 3 .vue files to add the new field
    console cd to root of project "php artisan asgard:module:publish Page"
    console cd to Themes/Adminlte and "npm run watch"
    console cd to root of project "npm run watch"
    house keeping "php artisan cache:clear" and "php artisan view:clear"

    What did I do wrong? Can you post here a very simple example how to add a custom field into the asgard cms?


  • admin

    Then you must have missed something with vue, because that's indeed the way to do it.

    Some pointers:

    • There's no need to compile the adminlte theme
    • no need to publish the page module


  • @nwidart can you please to explain this point "in the partials for the Page module add your field to edit and create blades"
    So as far as I understood I needed to add my files:

    my_proj\Modules\Page\Resources\views\admin\partials\create-fields-non-translatable.blade.php
    my_proj\Modules\Page\Resources\views\admin\partials\edit-fields-non-translatable.blade.php

    Is that correct?
    Or I needed to modify existing files?


  • admin

    No as I mentioned before you can't have to do this anymore as it's now handled by vuejs.


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.