Jump to content

PawelGIX

Members
  • Posts

    45
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by PawelGIX

  1. I have some custom fields and I wanted to add validation to them using hooks.
    Unfortunately, I cannot access the fields inside the images field.

    How to run custom validations on them and return an error when editing the page

    I want to add validation to aspect_ratio only when we have a given URL to the video

    image.thumb.png.f7f25cd786b343622ca4095006118475.png

    I have this much for now but I don't know how to move on.

    <?php
    wire()->addHookAfter('ProcessPageEdit::processInput', null, 'checkAspectRatio'); 
    
    function checkAspectRatio($event) {
        $form = $event->arguments(0);
    
        
        // ProcessPageEdit's processInput function may go recursive, so we want to skip
        // the instances where it does that by checking the second argument named "level"
        $level = $event->arguments(1);
        if($level > 0) return;
    
        
        if($form->get("additional_images")){
    
    
    
        }
    
    }

     

  2. I am trying to get some sites to remain in Unpublished status until certain conditions are met.
    However, I have a problem with the message ProcessPageEdit: Published Page.
    Overall, wire()->addHookAfter("Pages :: saved") seems to work for existing pages. And I can put them into Unpublished status whenever I want after I have saved them.
    But when creating a new page, the order of events is different. The newly created page is set to Published status when someone clicks Publish in the second step of the page adding process. But it runs after my code.


    How to solve this problem?
    Is there any documentation about the order of events?

  3. How to programmatically clear the page cache?
    I have a page that uses URL Segments.
    Based on the value of the URL Segment, the content of the page varies.
    From what I can see, the cache can handle it without a problem.
    But I have another question.
    I need to create an API that will clean the cache of selected pages - based on the value of URL Segments or some other value.

    Is there an API that will allow me to manage the page cache generated by PW?

    • Like 1
  4. On 3/10/2020 at 6:01 PM, BitPoet said:

    WireCache tries to be smart (too smart) when it finds a valid json string because it uses json to serialize array data for storing. So any string that look like json gets json_decode()ed into an array. It's kind of a known bug because there is currently only a part of a fix implemented in WireCache.

    I always have a problem with writing JSON data to wire ('cache') with this.
    It would be good if the documentation warned about such behavior.
    I think the cache should always return data in the format you sent it to.

  5. I have processwire 

    You don't have access to the template required to add pages here (in /wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module line 506)

    image.thumb.png.2ab629f83db170382ec20e056f06fabb.png

    I have ProcessWire 3.0.148. So far it has worked fine, but recently (maybe after an update) I am getting this error.
    The error appears when you try to add a new subpage using the Superadmin account. I think the superadmin has access to all options?

    Does anyone have an idea how to fix this?

     

    UPDATE: 
    It turned out that my settings in Family did not allow me to create a page from any template due to the configuration.
    The message misled me a bit;)

  6. I get error:

    Recoverable Fatal Error: Object of class DirectoryIterator could not be converted to boolean (line 671 of /home/users/g2s/public_html/automotive2/wire/modules/LanguageSupport/ProcessLanguageTranslator.module) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.

    When i access page /processwire/setup/language-translator/add/?language_id=1017.

    Latest stable ProcessWire.

    What can i do?

     

    UPDATE

    ProcessLanguageTranslator.module

    Line 671:

            // if(!$dirIterator) return array();
            if(!$dirIterator->valid()) return array();

  7. 4 minutes ago, AndZyk said:

    That is interesting, because it doesn't show anything at all. If it would be an .htaccess-error, at least an 500 error should be thrown. But it doesn't seem to be, because your front end works properly.

    Exactly. No PHP errors. No errors in PW logs. Server HTTP response 200. I have no idea what to do next

  8. For me, the ability to crop an image in Variations modal would be sufficient.

    1. Thumbnails created automatically.

    2. If necessary user could select and crop the image manually. Keeping the size and proportions of the original image.

    The column "NOTES" should contain information about the image, eg: "Banner image - used on homepage", "The image used in the list of posts."

    This information can be saved when creating thumbnails  



    $img->size(100,100, 'Post image')->url


    or using a GUI in the administration panel.

    post-446-0-34843100-1463400163_thumb.png

    • Like 1
  9. @PawelGIX - on another note, you should update the module to set the status of the Pixlr Image Process page to hidden so it doesn't appear in the Pages dropdown menu which is part of PW 2.5 (you can see what I mean in recent dev versions). 

    Fixed

    • Like 2
  10. I installed the PixlrEditor in PW 2.5.3 but it dont work. No buttons near image-field on hover like in earlier versions.

    Is there a chance to get it work?

    Compatibility issue with PW 2.5.x. 

    There is version 1.0.3 on Github. 

    • Like 2
  11. Hmm... I can't duplicate your error.

    Check if "Pixlr Image Processing" module is installed. 
    Check also if you have a page in: Pages -> Home -> Admin -> Pages -> Pixlr Image Process
×
×
  • Create New...