-
Posts
4,928 -
Joined
-
Days Won
321
Everything posted by Robin S
-
Inline styles getting auto added in ckeditor
Robin S replied to cleanboy3000's topic in General Support
Discussed recently here: -
Hi @netcarver, Right now the module can't do that. It's on my to-do list to update this module so that it has a hookable method that would allow the sort of thing you're wanting to do, but not sure when I'll get around to that. For now you could use a hook to hide/disable the trash icon, similar to what I described in this topic: In /site/ready.php: $wire->addHookAfter('InputfieldFieldset::render', function(HookEvent $event) { /* @var $fieldset InputfieldFieldset */ $fieldset = $event->object; $attr = $fieldset->wrapAttr(); // Fieldsets in a Repeater inputfield have a data-page attribute if(isset($attr['data-page'])) { // Get the Repeater item $p = $this->pages((int) $attr['data-page']); if($p->hidden_field != '') $fieldset->addClass('no-trash'); } }); In some custom admin CSS: /* Hide and disable the trash icon while keeping its space in the layout */ .no-trash .InputfieldRepeaterTrash { visibility:hidden; pointer-events:none; } You could use display:none instead if you're not worried about the icon alignment.
-
I did consider that but decided that show on click is preferrable and I'll stick with that. The original request that inspired this module references the Windows Explorer behaviour that shows dropdowns on click, and I wouldn't want to see menus flying out if my mouse happens to pass over the breadcrumb on the way to the main menu.
- 79 replies
-
- 2
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Good spotting, thanks. That's explained in the readme: Thanks, should be fixed in v0.1.1. The Home page is a special case that the module should leave alone because the Home page has no siblings to appear in a dropdown. I'm thinking that this is the error that @matjazp mentioned earlier, which actually isn't related to AdminThemeBoss. Although the modules are probably still incompatible if the "extended breadcrumb" option is activated in AdminThemeBoss.
- 79 replies
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Ah, yes, that does work. Thanks, I didn't realise your earlier comment was a suggestion to change to the string syntax. I will raise an issue for Ryan to take a look at as the array syntax is the one that's shown in the documentation example.
- 79 replies
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Yes, it is weird. I think it must be an issue with the modules directory as the "requires" condition looks legit to me. I remember @Macrura struck something like this before with his Selectize modules - maybe he knows more about it? For now I've removed the entire "requires" condition so the module is at least installable by classname from the directory. Will raise a GitHub issue on the PW repo if it's looking like it is a definite bug with the modules directory.
- 79 replies
-
- 2
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
There's no AJAX involved - unless you had a crazy number of parents the number of pages rendered in the menus isn't that many and it's better to have the dropdowns appear instantly I think.
- 79 replies
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
@adrian, it seems that the $page->siblings() method used in the module already sorts by the sort field defined on the parent page or template. Do you have that set for your blog items parent?
- 79 replies
-
- 1
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Hmm, it's installing as expected here. The "requires" setting I've used looks like it conforms to the example given in the Module documentation. Any ideas why it might not be working in your case? I use the "AddNewChildFirst" option in AdminOnSteroids for blog/news items and the dropdowns work well with that. But I get your point and will look at implementing something that honours the "sort settings for children" on the parent page/template. And add a note to the readme about the 25 item limit. Yes, very likely will not be compatible with that module as AdminThemeBoss already modifies the breadcrumbs.
- 79 replies
-
- 2
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
-
Breadcrumb Dropdowns Adds dropdown menus of page edit links to the breadcrumbs in Page Edit. The module also adds dropdowns in Edit Template, Edit Field, Edit User, Edit Role, Edit Permission, Edit Language, and when viewing a log file at Setup > Logs. Configuration options Features/details The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. Unpublished and hidden pages are indicated in the dropdowns with similar styling to that used in Page List. If the option to include uneditable pages is selected then those pages are indicated by italics with a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. If the current user is allowed to add new pages under the parent page an "Add New" link is shown at the bottom of the breadcrumb dropdown. If the currently edited page has children or the user may add children, a caret at the end of the breadcrumbs reveals a dropdown of up to the first 25 children and/or an "Add New" link. Overriding the listed siblings for a page If you want to override the siblings that are listed in the Page Edit dropdowns you can hook the BreadcrumbDropdowns::getSiblings method and change the returned PageArray. For most use cases this won't be necessary. Incompatibilities This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method. https://modules.processwire.com/modules/breadcrumb-dropdowns/ https://github.com/Toutouwai/BreadcrumbDropdowns
- 79 replies
-
- 13
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Designme - Visually Layout Your Edit Screens - Preview
Robin S replied to joshuag's topic in Modules/Plugins
When removing a field from Page Edit, is the user removing that field from the associated template? Does that happen on the fly or Is there some sort of "Apply" step that happens at the end with the normal warnings about the loss of data that will occur? If it happens on the fly is there an undo feature? I'd be a bit nervous about accidentally clicking on the field remove button otherwise. -
Welcome @torf! Profields Table would be ideal, but Repeater, PageTable and Page Reference (with modal editing via AsmSelect) are also candidates, or even a custom repeating fieldtype in the style of the demo Events module. Oh, and one more: child pages together with Batch Child Editor. And another: pages from anywhere (not just children) with inline editing via Lister Pro. So many options... ?
-
Thanks for the new search features @ryan! I wonder if the keyword to bring up the search help should be something less likely to be typed in by a site editor, e.g. "~help". Because it's not that unlikely that an editor might want to find a page with the word "help" in it. To test I created a page titled "Help" and that was not included in the results when I searched "help". The option to include search results from a module sounds interesting but I'm struggling to think of an existing module that might want to give search results other than pages. Maybe @adrian's Admin Actions module? What sorts of modules do you think would use that feature?
-
It's never overkill to create the fields you need to achieve the functionality you want. For efficiency PW sorts pages when it gets them in the SQL query. So when you get pages from the database whatever you want to sort on must exist as a column in the database. You can sort a PageArray independently of this but it's less efficient and will be problematic when you have a large number of pages or want to add pagination to your results. Also, think about the sorting of names like "Anthony van Diemen" if you were to try to sort without an explicit "last name" field. There is no need to enter anything twice. There are a few different ways you could go about it - here is the one that I prefer because it's simple and intuitive even if it does involve some minor redundancy of data... This assumes you have a template team_members that allows children of template team_member. 1. Install the core PagePathHistory module if you haven't already (a must-have for every site). 2. Install the Page Rename Options module. 3. Add text fields first_name and last_name to template team_member, right after the title field. Make them required fields, and a width of 50% would make sense. 4. In template team_member re-label the title field to "Full name" and set the field visibility to "Open when populated + Closed when blank + Locked (not editable)". 5. In the Family tab of template team_members set "Name format for children" to "Y/m/d H:i:s". This allows new pages added under this template to skip the first step of the "Add New" process. New pages will get a name according to the date/time they were added but this is only temporary until they are published or saved for the first time. 6. Add the following hook to /site/ready.php $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); // Only for the team_member template if($page->template != 'team_member') return; // Skip if this page is brand new and doesn't have any data yet if(!$page->id) return; // Derive the title (Full name) from the first_name and last_name fields // The Page Rename Options module will take care of updating the page name to match $page->title = $page->first_name . ' ' . $page->last_name; }); Now in your template files you can get and sort on the first_name and last_name fields independently. If you want the full name you could output those fields together, but why bother when you also have the full name in the title field. Having the full name in the title field is nice because things in the PW admin (Page List, Page Edit headings, admin search) continue to work without needing any special settings or additional hooks.
-
These two spring to mind: $user->isLoggedin() $user->isSuperuser()
-
Working fine here with AdminThemeUikit. Yes, this module adds features to a PageTable field, so you need to have FieldtypePageTable installed and add a PageTable field to your template. In v0.1.1 I have made FieldtypePageTable an install requirement for the module to avoid any confusion about this.
-
If you have a lot of fields on the page/template in question it would be worth increasing max_input_vars to see if that solves it. https://www.virendrachandak.com/techtalk/big-forms-and-php-max_input_vars/
-
The subfolder will be created, and you most likely are saving your file to the temp directory. You can check this with file_exists() after the file is saved in your script. But I believe what is happening is that subfolder and temp file are removed by the destruct() method of WireTmpDir during PHP shutdown. http://php.net/manual/en/language.oop5.decon.php#language.oop5.decon.destructor If you want the file to persist after the destruction of the WireTmpDir object then it looks like the WireTmpDir::setRemove() method is what you want. $wireTempDir->setRemove(false);
-
Hi @pout, welcome to the PW forums. ? If I understand right you have a Page Reference field "user" in your "order" template, and a Page Reference field "orders" in your "user" template. You can use the Connect Page Fields module to link these two Page Reference fields together - see the module readme for more information.
-
PageEditor, Children-Tab, possible to load children directly on open?
Robin S replied to horst's topic in General Support
If all you want the edit page to show is a list of children then maybe you would be better off replacing ProcessPageEdit::execute() entirely. E.g. $wire->addHookBefore('ProcessPageEdit::execute', function(HookEvent $event) { /* @var ProcessPageEdit $ppe */ $ppe = $event->object; $page = $ppe->getPage(); if($page->template != 'my-template') return; $event->replace = true; /* @var InputfieldForm $form */ $form = $this->modules->InputfieldForm; /* @var InputfieldMarkup $f */ $f = $this->modules->InputfieldMarkup; $f->name = 'ChildrenPageList'; $f->label = 'Children / Subpages'; if($page->numChildren) { /* @var ProcessPageList $ppl */ $ppl = $this->modules->ProcessPageList; $ppl->id = $page->id; $ppl->showRootPage = false; $f->value = $ppl->execute(); $template_sortfield = $page->template->sortfield; if($template_sortfield && $template_sortfield != 'sort') { $f->notes = sprintf('Children are sorted by "%s", per the template setting.', $template_sortfield); } } else { $f->description = 'There are currently no children/subpages below this page.'; } $form->add($f); $event->return = $form->render(); }); If you wanted the "Add New Page Here" button and "Sort Settings" fieldset too then you could add those by borrowing from the code in ProcessPageEdit::buildFormChildren(). -
Try this in /site/ready.php: $wire->addHookAfter('InputfieldCKEditor::renderReadyHook', function(HookEvent $event) { $inputfield = $event->object; $page = $inputfield->hasPage; $field = $inputfield->hasField; // Whatever test you need to identify when the asset page should be changed if($field->name === 'body' && $page->template == 'basic_page') { $js_config = $this->config->js('InputfieldCKEditor_' . $inputfield->name); $js_config['pwAssetPageID'] = 1234; // The id of the asset page you want to use $this->config->js('InputfieldCKEditor_' . $inputfield->name, $js_config); } }); Seems to work well in the PW admin, but the code comment here suggests it won't work for front-end editing.
-