Jump to content

Robin S

Members
  • Posts

    4,928
  • Joined

  • Days Won

    321

Everything posted by Robin S

  1. Looks really nice! Just wondering about the approach you've taken - if this module is about styling changes to the core AdminThemeUikit couldn't the module just add a CSS file containing the style overrides and not reproduce all the AdminThemeUikit files?
  2. But what I'm saying is that Profiler has a dedicated pro support board where you can get optimisation advice from Ryan, the creator of ProcessWire. Nobody knows more about optimising PW than him.
  3. Yes, I think the module should do this (or offer an option for it). Because the name field is normally on the Settings tab, and if you are removing that tab for a role then you probably don't want the role seeing any of the fields normally on that tab. You probably know this but it was new to me... you can add styles to an inputfield without needing to include a CSS file with the module: $if = $wrapper->getChildByName('_pw_page_name'); $if->wrapAttr('style', 'display:none;');
  4. @OviS, thanks for the report. Should be fixed now in v0.1.1.
  5. Me neither - still getting the same error without the File Compiler involved. I found that this works... protected function executeAction($options) { $pages = $this->pages; $p = $pages(1); } So it's not a difficult thing to work around, just puzzling is all.
  6. Testing with actual fields in the template (just for convenience, and will be the same for inputfields added dynamically with InputfieldWrapper::insertAfter(), etc)... Empty fieldset: renders fine. Empty fieldset tab: tab itself renders but not the tab content. Probably needs some inputfield contained within it even if that inputfield isn't visible. Try InputfieldHidden, or InputfieldMarkup with no markup and the skipLabelHeader option.
  7. It does seem like PW could get confused with this, but I don't think that's what's happening in this case because the Functions API is only used when enabled in config.php and I don't have it enabled. I also noticed that the PhpStorm code completer thinks that everything is hunky dory - see how it marks the string within the parentheses as a selector: My gut feeling is that it's something to do with the File Compiler. It would be interesting to test that by declaring the ProcessWire namespace in the module so the File Compiler isn't used (plus maybe the FileCompiler=0 line to be sure). But I've experimented with that a couple of times (I raised the idea of including the namespace by default here) and I can't get AdminActions to work when the namespace is declared. No doubt because I haven't studied the module closely enough - maybe you can see more easily how to get the module working with the namespace?
  8. Thanks Adrian, but I don't think that's it. I'm not using the Functions API in that line but rather the shorter selector syntax that was introduced here: https://processwire.com/blog/posts/processwires-roadmap-in-2015/ $this->pages is the API $pages object - what Ryan calls "a Wire-derived object (alternate syntax)" in the blog post linked to above. And that should work because ultimately a custom action for AdminActions extends Wire. It all looks right when I do some debugging dumps: protected function executeAction($options) { $is_wire = $this instanceof Wire; bd($is_wire, 'is_wire'); bd($this->pages, 'this->pages'); //$p = $this->pages(1); } But when I uncomment the last line with the latest module update I get a different error: So somehow $this->pages($selector) is interpreted as being a (missing) method of Test. But I can use the same line in methods of other modules without a problem. Weird.
  9. Hi Adrian, If in an action I try and get a page using the short $pages($id) form of selector then I get a compile error: My demo action: protected function executeAction($options) { $p = $this->pages(1); } If I use get() then it works okay: protected function executeAction($options) { $p = $this->pages->get(1); } Any ideas why the error is happening?
  10. I think you should create a module and share it in the modules directory. ? It sounds like it would be very useful for a number of different languages. If you only want to set the page name once when the page is first created you would hook after Pages::added() and pass the page title to Utf8Slugger::slugify() to get a name. Or if you want the page name to update whenever the title changes you would hook after Pages::saveReady(). For more advanced usages relating to the latter you might like to take a look at the code in @adrian's Page Rename Options module.
  11. On such a large site I reckon it would be worth investing in some professional advice. https://processwire.com/api/modules/profiler-pro/ Besides the tool itself there is the valuable benefit of VIP support from Ryan:
  12. Related issue: https://github.com/processwire/processwire-issues/issues/561 Ryan said: Probably not useful in your case seeing as you have an existing installation but there is the option to choose utf8mb4 from the installer: https://processwire.com/blog/posts/pw-3.0.15/#support-for-utf8mb4-and-innodb Also related:
  13. Maybe you are logged into admin in Safari and not the other browsers? In which case the issue probably relates to something that is accessible to a logged in user (or superuser) but not to guest.
  14. I agree with Adrian - in the future you might get too busy or just want to take a break from developing AOS and then users wouldn't be able to get new features or bug fixes that Ryan applies to the core admin theme. I also think it might turn out to be quite a hassle for you to apply core admin theme changes to your custom theme, because once the methods have been modified you won't be able to see changes easily via a simple diff. You'd have to monitor the core diffs instead and then manually hunt through your custom methods to find the equivalent locations. But once AdminThemeUikit has been the default admin theme for some period of time then I think it would be quite reasonable to say that AOS requires AdminThemeUikit and doesn't support the older themes.
  15. Hi @horst, Not sure if you have already solved this now, but below is a quick demo module. A couple of notes: The Children tab is supposed to AJAX-load automatically when visible, but it's buggy: https://github.com/processwire/processwire-issues/issues/618 I can't remember the details but I seem to recall there might be an issue if the name field is not present in the ProcessPageEdit form. So if you strike problems you may need to move the name field to the Children tab and then hide it. Maybe @adrian knows about the name field issue? <?php namespace ProcessWire; class HideTabs extends WireData implements Module { /** * Module information */ public static function getModuleInfo() { return array( 'title' => "Hide Tabs", 'version' => 1, 'autoload' => 'template=admin', ); } /* @var ProcessPageEdit $ppe */ protected $ppe; /* @var InputfieldForm $form */ protected $form; /** * Ready */ public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'afterBuildForm'); } /** * After ProcessPageEdit::buildForm * * @param HookEvent $event */ protected function afterBuildForm(HookEvent $event) { // Only for ProcessPageEdit (not ProcessUser) if($this->process != 'ProcessPageEdit') return; $this->ppe = $event->object; $this->form = $event->return; $page = $this->ppe->getPage(); // Only for one template (adjust as needed) if($page->template != 'my-template') return; // Remove the unwanted tabs $remove_tabs = [ 'ProcessPageEditContent', 'ProcessPageEditSettings', 'ProcessPageEditDelete', ]; foreach($remove_tabs as $tab_id) $this->removeTabFromForm($tab_id); // Trigger loading of Children tab // Hacky workaround for bug: https://github.com/processwire/processwire-issues/issues/618 $this->form->appendMarkup = " <script> $(window).load(function () { $('#_ProcessPageEditChildren').trigger('click'); }); </script> "; } /** * Remove tab from ProcessPageEdit form */ protected function removeTabFromForm($tab_id) { $tab = $this->form->find("id=$tab_id")->first(); if(!$tab) return; $this->form->remove($tab); $this->ppe->removeTab($tab_id); } }
  16. @pwFoo, here is demonstration module you can use as a starting point. Just install the module and then view "My Page". MyModule.module <?php namespace ProcessWire; class MyModule extends WireData implements Module { /** * Module information */ public static function getModuleInfo() { return array( 'title' => "My Module", 'version' => 1, 'autoload' => true, ); } /** * Init */ public function init() { $t = $this->templates->get('my-template'); if(!$t) return; $t->filename = $this->config->paths->MyModule . 'my-template.php'; } /** * Install */ public function ___install() { $this->createTemplate('my-template', 'My Template'); $this->createPage('My Page', 'my-template'); } /** * Create template */ protected function createTemplate($template_name, $template_label) { if($this->templates->get($template_name)) { $this->warning("Template '$template_name' already exists."); return; } $fg = new Fieldgroup(); $fg->name = $template_name; $fg->add($this->fields->get('title')); $fg->save(); $t = new Template(); $t->name = $template_name; $t->label = $template_label; $t->fieldgroup = $fg; $t->compile = 0; $t->noPrependTemplateFile = true; $t->noAppendTemplateFile = true; $t->save(); $this->message("Created template '$template_name'."); } /** * Create page */ protected function createPage($page_title, $template_name) { $page_name = $this->sanitizer->pageName($page_title, true); if($this->pages->get("parent=/, name=$page_name")->id) { $this->warning("Page '$page_name' already exists."); return; } $p = new Page(); $p->template = $template_name; $p->parent = '/'; $p->name = $page_name; $p->title = $page_title; $p->save(); $this->message("Created page '$page_name'."); } } my-template.php <?php namespace ProcessWire; echo "This is the template file for my-template"; MyModule.zip
  17. The module readme mentions a relevant option: You would set that to false if you don't want entities encoded.
  18. You're missing parentheses. // Save $word->save();
  19. Don't do this part... $p = $word; ...just work with $word directly to change its parent. If it still not working in all cases then focus on the step where you get the parent page: $parent = wire('pages')->get("parent=$page, template=exercise, name=exercise-$number"); There is no guarantee this will always return a valid page, so you might want to check that $parent has an id > 0 and if not log/dump $word->id or something so you can find where the problem is.
  20. It's FileCompiler getting confused by strings containing the name of API variables next to parentheses. GitHub issue: https://github.com/processwire/processwire-issues/issues/98 A moment ago I was seeing the same issue as you for "File (for FormBuilder)", although after making a small edit to the module file (which triggered a recompile) the issue resolved and now I can't reproduce it again even after reverting to the original module file. I also can't reproduce the issue with "TemplateEngineTwig" so not sure what's going on exactly.
  21. I reckon it's a bug. I opened a GitHub issue with a possible fix: https://github.com/processwire/processwire-issues/issues/627
  22. I think you may need a semicolon inside the quotes. config.extraAllowedContent = 'p(tip);'; The CKEditor docs are not 100% clear about when semicolons are needed but you can see them included in some sample code here: https://docs.ckeditor.com/ckeditor4/latest/guide/dev_advanced_content_filter.html#custom-mode
  23. Nothing is required outside of your module - make your module autoload and use the init() method in your module. The filename is not a property that is saved to the database - it is generated at runtime from the template name, so if you want to set a custom filename then this must be done at runtime. The comment in the Template class is clear about this: @property string $filename Template filename, including path (this is auto-generated from the name, though you may modify it at runtime if it suits your need). #pw-group-files
  24. It is possible. I added example code to your GitHub request: https://github.com/processwire/processwire-requests/issues/204#issuecomment-400535558
  25. I haven't needed to use pagefileSecure before, but it sounds to me like a permissions bug relating to the fact that non-superusers have limited access to repeater pages. There have been a few such issues in the past. Unless someone chimes in with a solution I suggest raising a issue in the GitHub repo: https://github.com/processwire/processwire-issues/issues
×
×
  • Create New...