elabx

Members
  • Content count

    236
  • Joined

  • Last visited

  • Days Won

    3

elabx last won the day on December 29 2015

elabx had the most liked content!

Community Reputation

285 Excellent

About elabx

  • Rank
    Sr. Member
  • Birthday 04/12/1988

Profile Information

  • Gender
    Male
  • Location
    Mexico City

Recent Profile Visitors

3,646 profile views
  1. Didn't know this tool, seems much more equipped than Server Pilot, am I being fare in this comparison?
  2. It's really amazing how much work can be done adding Hooks where needed and you can turn Process modules and Inputfields into powerful interfaces just understanding a bit of the source code, I now don't want to write app interfaces/data models anymore, just think how I can leverage ProcessWire to do anything I want, in a third of the time. Hope everyone keeps sharing their awesome work!
  3. Works great! Just added: $match["template"] == "admin" Because I didn't want normal "content" pages being modified. Thanks a lot for the help!
  4. Is this a ProcessWire friday happiness guest blog post request I'm reading?! 'cause it would be awesome.
  5. 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!
  6. 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)
  7. I can't contain my happiness, thanks for this awesome update.
  8. 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; } }
  9. @darkolina Siii me acordé :')

  10. @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);
  11. 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
  12. Hi! Any info on how to add repeater item types through API?
  13. Oh thanks! Another brilliant example of RTFM.
  14. 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.
  15. 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?