Jump to content

elabx

Members
  • Posts

    1,246
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by elabx

  1. Hi people! Is there a way to hook into the way the results of the admin search results are rendered? I'd love to make the links to the pages in the list go to the "view" page instead of the "edit" page specially in modules rendering a Process module. For example, look for the Fields page, and it will link you to edit the Field page. I've looked into the ProcessPageSearch module but can't find any javascript that renders the actual list, any clue? Thanks for further help!
  2. I have used Repeater Matrix for this purpose, to create a type of page builder, each repeater type being a possible section, though you still have to have a predefined set of repeater types, most of this types have a checkbox or two for customization of behaviour (even repeaters inside, works wonderful)
  3. I can't contain my happiness, thanks for this awesome update.
  4. Have done this for image fields, it adds a button to the end of the inputfield, code below. Checks for ZipArchive class before installing. Now that I read the code it should work for files but haven't tested! It's got configuration options too, to enable per field basis, either way should it should be super quick to edit if something is not working. <?php class ExportFieldImages extends WireData implements Module, ConfigurableModule { static public function getDefaultConfig() { return array( "includeFields" => '' ); } public static function install(){ $session = wire("session"); if(!class_exists('\ZipArchive')){ throw new WireException("ZipArchive is required to create the zip file"); } } public static function getModuleInfo() { return array( 'title' => 'ExportFieldImages', 'version' => 0.1, 'summary' => "Adds a button bellow images field to download a zip containing files.", 'author' => 'Eduardo San Miguel Garcia', 'singular' => true, 'href' => '', 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldImage::render', $this, 'afterInputfieldImageRender'); $this->addHookAfter("ProcessPageEdit::execute", $this, "pageEditExecuteBefore"); } public function pageEditExecuteBefore(HookEvent $event){ $session = wire("session"); $input = wire("input"); $page = wire('pages')->get($input->get->id); $name = $page->name; $zip = $config->paths->cache . "${$name}.zip"; if($input->get->downloadImages == "true"){ wire("log")->save("custom", "excecuted page edit!"); $array = wire('files')->zip($zip, $page->get($input->get->field)->explode("filename"), array("overwrite" => true) ); if(!empty($array["errors"])){ foreach($array["errors"] as $error){ $this->error($error); } return; } else{ header('Content-Type: application/zip'); header("Content-Disposition: attachment; filename='{$name}.zip'"); echo readfile($zip); return $this->halt(); } } } public function afterInputfieldImageRender(HookEvent $event){ $field = $event->object; $input = wire("input"); $configData = wire('modules')->getModuleConfigData($this); $out = $event->return; if(in_array( $field->name, $configData['includeFields'])){ $button = wire('modules')->get('InputfieldButton'); $button->class = $button->class . " ExportFieldImages"; $button->icon = 'download'; $button->href = "./?downloadImages=true&field={$field->name}&id={$input->get->id}"; $button->value = "Download Files"; $btn .= "<span style='display:block; position:relative; float:right;' class='InputfieldPageTableButtons'>" . $button->render() . "</span>"; $out .= $btn; } $event->return = $out; } public function getModuleConfigInputfields(array $data){ $modules = wire("modules"); $fields = wire('fields'); $defaults = self::getDefaultConfig(); $data = array_merge($defaults, $data); $form = new InputfieldWrapper(); $field = $modules->get("InputfieldAsmSelect"); $field->name = "includeFields"; $field->label = __("Fields to enable download button"); $field->description = __("Choose the image fields where download button should appear"); foreach($fields as $f){ if($f->flags & Field::flagSystem) continue; if($f->type == "FieldtypeImage" || $f->type == "FieldtypeFile"){ $field->addOption($f->name); } } $field->value = $data['includeFields']; $form->add($field); return $form; } }
  5. @darkolina Siii me acordé :')

  6. @adrian Got this almost settled, do you have any information on how to save the fieldgroup conext settings for the repeater matrix field?? I see that they are saved through namespaces but I just can't seem to find a way to save them, this is what I am trying: EDIT: Found out, edited code below: $matrix_field_name = "content"; $matrix_type_namespace = "matrix12"; //Field inside repeater you want to edit it's property. $matrix_repeater_field_name = "feature_card_items"; $matrix_template = wire('templates')->get("repeater_$matrix_field_name"); $fieldId = wire("fields")->get("feature_card_items")->id; $matrix_fieldgroup = $matrix_template->fieldgroup; //Get the config data from the fieldgroup and the namespace which determines the field's settings based on the matrix repeater type. $matrix_field_data = $matrix_fieldgroup->getFieldContextArray($fieldId, $matrix_type_namespace); //Copy the data to edit it $matrix_field_data_new = $matrix_field_data; $matrix_field_data_new["description"] = "Bla bla bla"; //Reassign the data to the fieldgroup $matrix_fieldgroup->setFieldContextArray($fieldId, $matrix_field_data_new, $matrix_type_namespace); //Save fieldgroup context data, only unknwon wire("fields")->saveFieldGroupContext($matrix_fieldgroup->getField("feature_card_items", true), $matrix_fieldgroup);
  7. Confirmed it is still a bit unstable for some cases and behaviours and it's not really "a theme" yet, so design wise the already existing theme works a lot better IMO
  8. Hi! Any info on how to add repeater item types through API?
  9. Oh thanks! Another brilliant example of RTFM.
  10. Hi! I am having trouble with images not being shown to other users that dont have superuser role. All images were uploaded by superuser with id 41. I added media-manager permissions to the role in question, and then the role to the user, is this enough? Also the options of media manager are configured to show all user images.
  11. Hi again!! I am planning to run Migrations loading multiple PW instances this way ,with a script running on the shell . I am getting the issue of the classes not getting loaded due to the way the path is specified (or at least this is the assumption) I changed it to be relative and everything seems to work, would this break something that I might not be foreseeing?
  12. The lister Inputfield integration appeared only in my dreams, great, great addition! Does it work with a ListerPro?
  13. I think the price of current Pro modules like around 150-200 USD for dev multi-site license is quite fine. If it solves the problem it should already be saving you lots of time and money!
  14. Thanks for answering! Please don't mind the delay! I do have access to ListerPro but I was looking to export from within the Page edit screen, with an Export button I place on a PageTable Inputfield through a hook (to export the fields data in a CSV file). So I thought "I must use something already done just for the export part!". Actions on ListerPro never crossed my mind!! Ended up coding it, found great comments on other posts dealing the data-to-csv problem. So now I have an ExportPageTableToCSV!
  15. Has anyone have any experience adding fields to Repeater Matrix items (through the API of course)? Like, add a new field to certain repeater matrix type.
  16. Hi LostKobrakai! Great module! I'm using it to maintain a series of sites using very similar features. I didn't want to be creating, configuring fields accross ten installations. Could it be possible to create a shell script that runs migrations across multiple ProcessWire installations? Let's assume all installations are running on the same server, with multiple docroots for each PW install.
  17. Thanks for the suggestion! Sooo, what I have to do is keep order haha, cause right now I've been making pulling changes from branch to branch, or to master. I guess I have to limit myself to a one way flow. Version control != Project management
  18. Hi everyone! I'm developing multiple sites that use the same codebase for templates. I am using git branches to take control of the changes on each branch (one branch per site, each template folder is a different worktree with the branch checked out) and push the changes to other branches when necessary. So far this has proven to be very useful. But now I come to get some thoughts,opinions, answers.. Now, I want to be able to do this: Let's say current page uses mytemplate.php. If custom.mytemplate.php exists, use it instead. this way, I can .gitignore custom.* and still have the flexibility to apply custom changes to every site that translate to other branches, sacrificing tracking the customizations on each branch due to the .gitignore, but that also simplifies the merging on other branches (for updates that have to translate everywhere) Do you think I could have a better approach for keeping track of customizations, maybe just be more carful on the merges when pulling changes? Could the "template swap if alternate file exists" thing get done in a Hook? Any other opinions or experiences doing a similar thing would be appreciated.
  19. On a map I setup, I had the trouble of encoded (ampersend made me notice) characters not getting output decoded correctly, so I had to add htmlspecialchars_decode on this this line: $title = $options['markerTitleField'] ? htmlspecialchars_decode($page->get($options['markerTitleField'])) : ''; Shouldn't this be the expected behaviour? And why is the page title getting output without decoded entities? Is this expected inside modules for security reasons? Just trying to learn some PW here
  20. But that should not compile!!! Maybe if Basic? haha
  21. I believe you would have to customize ckeditor with a plugin, such as this one for bootstrap. Also here is a Drupal module meant to add uikit button classes through a small dialog, could be a starting point for full fledged tool If you download the module you'll see there is a folder called ukbutton which is the actual Ckeditor plugin (example of plugin installation here) You can also go for the absolute minimal way which is adding Custom Style classes.
  22. https://github.com/processwire/processwire#upgrading-processwire I think this is the most complete guide. Upgrading from 2.x to 3.x must be carefully done as you can read. Most of the time, I haven't had troubles with the core, most likely a third party module. I have yet to see ProcessWire break with an update. There's also the upgrade module. which also makes a db backup before upgrading and renames the previous files with a dot at the beginning.
  23. +1000 to put this in core
  24. This is very likely the reason! I've gone through this types of errors a lot! Images with AdobeRGB or sth alike.
  25. Same story, different country haha. There is not a ListerPro "skin" . So assuming from the type of client yo you are dealing with, you'd be better off satisfying their UI/UX needs, or at least what they are used to. Because you're gonna end up fighting PW's markup and overriding it's styling. and end up with a bloated thing rather than the elegant solution ListerPro is meant to be. Customising the admin is easier now with the new UIKit based theme. But truly, here is where PW shines its brightest, leveraging the selector API makes building a lister pretty straightforward, I mean, the screen you post is basically a graphic description of what the selector API can do. So from what you mention about the project you are involved in, just build the thing and make people happy If you manage to reuse that frontend in the screenshot, it's basically just getting the data from the front to the back and let PW do the rest.
×
×
  • Create New...