Jump to content

gornycreative

Members
  • Posts

    351
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by gornycreative

  1. If you want to try the example I built (it looks for css/less files in assets/fonts and templates/ and then parses font families and returns a select options box with unique path/font family pairs) let me know and I'll tidy up an example and attach it.

    On the backend it gives me this:

    image.thumb.png.9fa2bb0eb849834f4e2892d7f5fc34ac.png

    • Like 2
    • Thanks 1
  2. @Macrura sorry I meant $wire->files... I did end up finding a way to do what I needed to although I came across a few interesting issues that I can't really explain.

    The functions were from a module context, so I had to pull them abstract them away from $this and just tried to manipulate them directly, since it seemed like a $wire object should still exist.

    When I ran a db($wire->files) the bar dump said that this did represent a WireFileTools object, but the find() method was faulting, saying that the object was null when I tried to use $wire->files->find($something, $somewhere). Are the API helpers only available in certain contexts?

    What I ended up doing was the following:

    First, I brought my functions into a separate _theme_fn.php file. If I included them in the main Inputfields generating file, I got a cannot redeclare error, perhaps the settings factory config file is iterated in some way. I put both my settings factory config file and the external functions file in the PW namespace.

    Second, in the external functions file I brought in a $wf = wire('files') and $wc = $wire('config') to the functions which allowed me to grab default paths, run the file searches and create the appropriate select options arrays.

    Third, in the main settings factory file, did an include_once on the functions file and then I just set variables to call those functions and then inserted that into options.

    This lets me generate select options arrays dynamically.

    If you want a concrete example, let me know.

    It is hard for me to determine sometimes whether I am able to use an API variable or have to actually call functions to create my own object on the customization side. Front end side and modules seem much clearer.

    • Like 1
  3. This module has been very useful. As I have been playing around more with module configurations for my own work I have started using $wire->file methods to find files and populate options for dropdowns for my modules.

    Regarding Settings Factory, I have set manual select options in the past, but it would be great to know if logic can be placed in the settings file to generate options using wire objects.

    I realize the PHP style settings factory configuration file uses InputfieldWrapper, etc. The settings file itself isn't namespaced and doesn't seem to instantiate anything. $wire->file itself, in the context of the settings file, seems to be null.

    Are there any objects available to use to manipulate file via the wire object (find files, grab config paths), or would I need to write those functions with php?

    Have you used logic to dynamically build select options?

    Thanks again! ~J

  4. Looking at the modules install() code it doesn't actually do a duplicate check when a module is first installed - at least I couldn't find any calls to methods that suggested it.

    Once a module config is in the db table the flags flip and duplicate data entries appear in the JSON payload when the modules cache is refreshed, but there doesn't seem to be any reference to that information under other circumstances - so until one version is installed and the config is saved in the db, PW doesn't recognize duplicates exist in the filesystem.

    Not a high priority item, but I'll make an issue for it on github. Could save some headaches down the line.

    • Like 1
  5. For some reason on a new site on 3.0.208 a duplicate module is not being detected. I have the standard release and a multisite modified version.

    On my established sites I am able to choose between the two module base directories but on a new installation with 208 and the same module folder it only detect the first module of the pair and will not install it because of a class name conflict.

    I've tried clearing cache, setting the appropriate cache disabling rule on cloudflare, deleted compiled files and tried removing one version, installing the remaining version and then adding it back it. The duplicate module is not seen.

    This is for two module codebases that define the same class and exist in two different folders in the /site/modules/ directory.

    Sites upgraded to 208 don't seem to have the issue. I can install and configure the module on upgraded sites and select the version on the configuration page.

    • Like 1
  6. I usually do post rock:

    Sigur Ros
    Under Byen
    Album Leaf
    Godspeed You! Black Emperor, etc.

    Sometimes some shoegaze

    My Bloody Valentine (duh)
    Fleeting Joys
    Blonde Redhead, etc.

    Often game soundtrack bits:

    Amos Roddy (Two Kingdoms franchise) - this gets LOTS of play - just super calm and thoughtful ambient.
    Disasterpeace (Fez, Hyper Light Drifter)
    Bioshock scores and the Black Mesa score
    Love the Limbo soundtrack - its just too short. He's got some tracks in a few other games but they just aren't as interesting IMO.

    Lots of Fripp and GC stuff, some Eno also.
    Sometimes the prog side but usually that's too engaging to code.

    Dunno, all over the place in general.

    Lately I've been on an old Tame Impala and old Phantogram kick.

    My playlist is all over the place. Sometimes classical - Holst, Bartok, etc.

    I think the only rule is I have to be familiar with it. I can't just throw a new Tool album on or something and think I'm going to be able to concentrate.

    • Like 5
  7. You don't have to support multisite with your tools - it just will make sense to mention that in your feature set.

    If a person installed multisite according to the tutorials/instructions provided on the PW site:

    https://processwire.com/docs/more/multi-site-support/

    Under option #1 they typically will have a directory structure where their main website install is under /site/ and subsequent sites start in tmp/site and then are moved under /site-1/ /site-2/ or something similar.

    For example, a person installs a new /site-3/ and decides they want to try your front-end plugin. They add your module to /site-3/ and want to install a new uikit profile there.

    They might be shocked and upset to find their /site/ folders and files were modified. I'm guessing you'd hear about it.

    • Like 1
  8. Hi @bernhard:

    I tried to use this in a multisite environment, but /site/ is hardcoded in a few places rather than use of the $this->wire->config->paths->site value.

    In particular the StylesArray.php class where paths get passed to LESS methods,

    Also the excludeDefaults paths in LiveReload.php

    In the main RockFrontend.module there is hardcoding in the renderMatrix method - I haven't used it yet, but I noticed it going through.

    A way to reproduce might be an installation where you rename the /site/ folder to something else - as in multisite the different site folders are generally called something like 'site-domain' or something similar.

    I guess I am the only one who still has some multisite installations, but for some projects it make maintenance simpler and more consistent.

     

     

    • Like 1
  9. Getting a strange error on PHP 8 fresh install, v 3.0.207

    Module version is the latest.

    Looks like $configData['CKEaddons_plugins'] is not getting initialized properly? It's coming across as NULL even though the defaultConfig array defines the default as an array. Not sure if this has anything to do with the transition to TinyMCE?

    image.thumb.png.59e4b6671def1910f9775db7d8821d38.png

     

  10. It's been awhile since I have installed another site on a multisite instance, and for some reason the new installer with separated site-profile folders just doesn't work for this setup.

    I can resort to cloning another database schema and try to make it work manually but there is really no clear documented method for managing this scenario.

    I've also tried putting the site-blank profile folder in all sorts of places and it simply never gets detected. I'm going to dig into the code to try to find the answer, but honestly this should be documented if there are going to be hard stops now in the installation process.

    EDIT: Looks like I need to rename my /site/ folder - put the site-profile folder in the root directory, do the installation and then rename the directory to whatever it needs to be for multisite redirection.

    Gah.

  11. Not meaning to raise a zombie thread, but in case others have this question...

    Instead of symlinks, it may make sense for you to set up a root installation that holds all of the things you'd like to share and then alter config paths in your config file...

    So for example, in a /site-realsite/ installation with a root /site/ install where you keep all of the module code you want to share between multisite installs:

    $config->paths->siteModules = $config->paths->root . 'site/modules/';
    $config->urls->siteModules = $config->urls->root . 'site/modules/';

    My guess is you could also do the same thing with scripts and styles paths? or at least your templates path.

  12. What's the best way to access $adminTheme methods from a module setup?

    I'm trying to add

    $adminTheme->addClass('body','chroma');

    as I would in an admin template file replacement but I am not sure where it is in the wire modules hierarchy or if there is a hook.

    I've tried calling it as a module from the ready() function but it's an abstract class. Not sure what to do.

     

  13. I don't know if this is a bug or a feature, but I discovered when trying to

    @import (optional, inline) '/path/to/some/file.css'

    The code from the css file is brought into LESS but the relative url references do not get adjusted (thus they break).

    A standard LESS @import of css happens like any other type of import. I was trying to consolidate my css.

    So as an example, I'm trying to import a css that declares a font-face:

    @font-face {
        font-family: 'Acherus Grotesque';
        src: url('acherus_grotesque_-_regular-webfont.woff2') format('woff2'),
             url('acherus_grotesque_-_regular-webfont.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }

    The css file resides in a subdirectory with the font files - pretty typical.

    It works fine when I run it as @import (optional), but when I bring it inline it shows up unmodified in the final LESS.

    As a result, it looks for font files in the site/assets/ folder where the admin.css file gets written.

    Is there a workaround/option I'm missing? I've tried setting the option to process as less files - no difference.

     

  14. UIKit uses four different color designations:

    image.png.1f8f03fa299f2def1e79ab4aea689965.png

    You mentioned above that UIkit conventions only have two colors. I was just saying that there are four colors to be concerned with if you are trying to create dark and light themes.

    I don't use slang, but I do tend to use what are called sentence fragments if I am writing a quick note. These fragments are probably not easy to translate. I will avoid them if I can.

     

    • Thanks 1
  15. On 11/20/2022 at 9:18 AM, bernhard said:

    IMHO AdminThemeUIkit should stick to uikit conventions (primary color, secondary color) and the reno style should override those where necessary (not the other way round).

    There's blue and black in the primary and secondary, but we can't discount default (white) and muted (gray) in UIKit specs. Particularly if there is a desire to be able to engage light or dark options.

    Haven't installed it yet - I'll add it to the checklist though as I plan on using it.

     

  16. 16 hours ago, gebeer said:

    This is because the API docs are auto-generated from the PW code. Since ConfigurableModule is an interface and not a class, the documentation for it is not being picked up by the script that generates the docs. But you have the path to the file in the core that defines the interface and there you have extensive documentation https://github.com/processwire/processwire/blob/master/wire/core/ConfigurableModule.php

    Yup I get that.

    Just a suggestion that if a link is going to be included in a tutorial 'Next Steps' a step should actually exist, or perhaps suggesting that a person look at the source code in core for documentation is in order.

    The documentation in the source is very helpful - I think that's a feature that gets buried often and isn't brought up to new users. It was awhile before I realized how much extra information was in there for devs.

  17. I am working through several color calculation options that will be part of my style module. I will let folks know when it is ready.

    Yes, UIKit's use of default, primary, secondary, muted provides a lot of color options.

    My interest is in being able to offer option for selecting up to three colors and having caluclations to provide adequate palettes for each, including UI contrast concerns.

    And yes, those highlights are part of the issue, as well as highlights/focus color changes on certain inputfields, and yes, there are buttons that appear in different places with either reno coloring or default coloring (like the delete button in certain areas).

    Likewise, the alert color schemes don't always necessarily fit well with different color schemes. That's what I am experimenting with at the moment.

    • Like 1
  18. Hi,

    I'm trying to wrap my head around configurable modules. The issue I am running into is that I'm not sure when or how to get the configured values to be used for other backend processes.

    At first, the config saved but nothing on the backend in terms of methods was using those value.

    Now when values change, the backend methods pick up the changed values to the config and uses those in my method calls, but if a value didn't change it doesn't get brought in to my public vars.

    The structure I have in place (roughly) is:\

    class ClassName extends WireData implements Module, ConfigurableModule {
    
    	getModuleInfo() {
    
    	}
    
    	public var declarations
    
    	public function ready() {
    
    		$mod_config = modules()->getConfig('ClassName')
    
    		//I have code here that assigns values from the $mod_config array to my public vars if values exist
    
    		
    
    	}
    
    	public function getModuleConfigImputfields() {
    
    		//Here I've got my fields set up properly and the config saves fine and values load fine from the DB.
    
    	}
    
    }

    Is there something else I need to do to utilize those values?

  19. I wish I could live and program in a world of "shoulds" but years of working in the WordPress ecosystem has cured me of holding free module developers to high expectations.

    I do agree that the module format should have either its own css and/or less asset folder, but I also take into consideration that adding LESS and AdminStyleUIKit features to PW is a very recent endeavor. It's one I support and would have certainly argued for, but in working with many old and new modules in the directory, there are a lot of abandoned modules that are still in production which don't necessarily conform to what has been built recently.

    It's worth discussing how modules should handle their assets - including scripts and styles - on the admin side.

    Maybe a new thread?

    • Like 1
×
×
  • Create New...