Jump to content

Is anybody at all using ALFRED?


Recommended Posts

  • 2 weeks later...
  • 1 month later...


I'm just starting trying to use Alfred, it looks like, as it is the only way to provide frontend editing using the HTML markup of the fields from backend. 

Right now it is working as logged in with admin, but it should work also for editors on frontend. 

I hope to have it ready soon.

Since it is not working on frontend with editor permissions, I'll just post here my problems:

In console of the browser there is the log

console.log("Loading jQuery...");
jQuery not found

The access / Role is already granted to "rockfrontend-alfred".

By the way, it is fantastic, that alfred is so flexible and can be limited to specific fields of a template!!!



Link to comment
Share on other sites

Ok so ALFRED will stay in RockFrontend, thx for letting me know @gornycreative and @MarkE

47 minutes ago, imandreas said:

But for any reason for the admin is showing in modal view, for editor it is opening the PW backend. 

Is there a way to configure this behaviour ?

That's not intentional behaviour and I've never experienced something like this. If you provide instructions on a fresh installation with step by step guide to reproduce the issue I can have a look into it.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

@bernhardI've been trying to get Alfred working on my local ddev stack - but have failed so far.  I've added the needed {alfred($page, 'fieldname')} code to the latte template to trigger alfred inclusion on the page render - and the script is being included, and is download from the server. I view site, while I'm logged in as superuser (ddevadmin).  Just like iamandreas, I get the following...


I've checked the role rockfrontend-alfred is present, and the ddevadmin is a superuser.

I've now tried this with a PW dev & PW master codebase, in three separate ddev installs - one with the default docroot - and have had the same result on each one. Setup was super easy with ddev and then rockshell, and they all had your RockFrontend site profile installed.  So, it looks like jQuery isn't being included in the scripts when needed maybe??  Anyway, will dig some more.

Link to comment
Share on other sites

Hi, it is almost 6 months, since I worked on this, but I remember, that you have to use the jquery version from PW admin.

You should see the magic lines "ALFRED is ready :)" in console, if you include the PW jquery, which is loaded by alfred

Maybe that helps

2024-04-09 11_32_14-.png

Link to comment
Share on other sites

We made like this, in the header PHP template we checked, if the user is able to edit the page

if (  wire('page')->template == "user-item-template"  and (wire('user')->hasRole('frontendeditor') ) ) {
        echo "<!-- skip jquery -->";
    } elseif (  wire('page')->template == "user-content-template"  and (wire('user')->hasRole('frontendeditor') ) ) {
        echo "<!-- skip jquery -->";
    } else {
        <script src="<?php echo $config->urls->templates;?>js/jquery-3.7.0.min.js"></script>

Then it was possible to call the alfred:

<div class="btn btn_default" <?= alfred($item, "title,text,content") ?>>
														<i class="fa-solid fa-pen-to-square"></i> Edit

It was opening the edit mode in a modal view with some administration header stuff.

  • Like 1
Link to comment
Share on other sites

Hi @imandreas Yes, I changed this in _init.php and Alfred now runs as expected. My point is that I think this should be included automatically within the RockFrontend site profile, or be in the RockFrontend documentation for Alfred.  Or perhaps the code for Alfred could pop up a JS alert box indicating the need to load JQuery - which would save having to look at the console.

  // load uikit
  ->add('/site/templates/uikit/dist/js/uikit.min.js', 'defer')
  // load custom javascript of this project
  ->add('/site/templates/scripts/main.js', 'defer')
  // load jQuery from /wire to allow ALFRED testing
  ->add('/wire/modules/Jquery/JqueryCore/JqueryCore.js', 'defer') // <<< Added
  // minify on production
  ->minify($config->debug ? false : true);

This is just to get things running for testing - would need to conditionally include it only if alfred is needed.

  • Like 1
Link to comment
Share on other sites

Ok, everything seems to work out of the box if you first install PWs PageFrontEdit module (which I didn't do as they were all fresh installs!) I guess this is what fulfills Alfred's JQuery dependency without the need to edit the _init.php file.

@bernhard Could the code catch this by default?  So if the need for alred is detected server side, but PageFrontEdit is not installed, add a message about installing it? Could also be added to the alfred script so it pops up an alert about installing PageFrontEdit?

Link to comment
Share on other sites

Hi @netcarver

thx for helping to improve RockFrontend 🙂 

53 minutes ago, netcarver said:

Could also be added to the alfred script so it pops up an alert about installing PageFrontEdit?

Done in the latest commit on the dev branch 🙂 


This pops up as soon as you add {alfred(...)} somewhere in your markup and the module is not installed. I've also added a note in the docs.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...