Page Module - Custom Fields, Not working



  • 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.