Jump to content

Robin S

Members
  • Posts

    5,039
  • Joined

  • Days Won

    340

Everything posted by Robin S

  1. Yes, it was an oversight. As more states need to be indicated in the dropdown items it gets harder to come up with distinguishable and tasteful styles for all of them. I think the hidden and unpublished pages need to use the same styling as in Page List, so that means I've had to change the styling for uneditable pages - these are now indicated by italics and reduced opacity (and the "not-allowed" cursor for devices that support hover). Other changes introduced in v0.1.7: The dropdowns now take $page->listable into account, so non-listable pages do not appear in the dropdowns. There is now a hookable BreadcrumbDropdowns::getSiblings method in case anyone wants to override the listed siblings for a page. This won't be needed in most cases though.
  2. I can't think of any reason it wouldn't work on multi-language fields. What specifically is not working for you? Double-check that you have added the Remove Blocks textformatter to the field in question... ...and you have placed your delimiters around the content you want removed.
  3. Cool, I didn't know that one. That syntax works for a plain textarea field, however none of the variants are working for me in a CKEditor field. Probably the HTML tags prevent the normal markdown parsing.
  4. First thing would be to use Tracy to check what the value of $x is when you create your repeater pages. Your post doesn't show where this variable is declared - maybe it is being reset within your loop or isn't incrementing as expected for some other reason.
  5. @joshuag, how can I configure Recurme permissions so that users can see and use existing calendar(s) in admin, but not configure/delete/add new calendars? I figure what I've described is the most commonly needed scenario, where the developer creates and configures calendars but users can use them to see/edit/add events. It seems that if I give the recurme-calendar permission to a role then the user gets too much freedom to create disaster, but if I don't give them the permission then they cannot see/use the calendar. To clarify, in the first screenshot it is the cog icon I want to hide, not the calendar itself. Edit: I see now that you can't add new events from the admin calendar. Feature request: it would be cool if you could though, so that hovering a day showed an "Add new" link that started the process of adding a new event with the start date pre-filled.
  6. My final code for {mailto} tag replacement: $tags = findSmartyMailtoTags($markup); // Ryan's regex function as shown above foreach($tags as $tag) { $href= 'mailto:' . $tag['attrs']['address']; if($tag['attrs']['subject']) $href .= '?subject=' . rawurlencode($tag['attrs']['subject']); $link_text = $tag['attrs']['text'] ?: $tag['attrs']['address']; $replacement = "<a href='$href'>$link_text</a>"; $markup = str_replace($tag['tag'], $replacement, $markup); }
  7. Thanks Ryan, that is fantastic! I was curious about which would be faster, but after testing both functions they seem to be nearly identical in terms of speed.
  8. v0.1.6 released - introduces a feature for adding a new sibling page, as requested above by Adrian.
  9. That's great, thanks! Just a couple more things and I'll have it sorted: 1. I need the match to be specific to the {mailto...} tag. That regex would currently also match {foo animal="cat"} 2. I need one of the matches to be the entire tag, so I can replace the tag with my reconstructed mailto link. Any ideas how it could be modified for those two objectives?
  10. My knowledge of regular expressions is pretty weak - one of the things I need to improve on. If anyone can offer any help for the following scenario it would be much appreciated. I need to import a heap of content that contains Smarty tags for encoded email addresses. When I import the content I want to convert these tags to regular mailto links. An example tag: {mailto address="someone@domain.com" encode="javascript" text="link text" subject="The subject line"} And another: {mailto address="someone@domain.com" encode="javascript"} I have got some way with this but am falling down when it comes to optional capturing groups. The requirements for my regex are: The regex must match {mailto all the way through to } (because I want to ultimately remove the whole tag) The address parameter must exist, and I want to capture its contents: someone@domain.com The text parameter may exist, and I want to capture its contents if it does exist: link text The subject parameter may exist, and I want to capture its contents if it does exist: The subject line Thanks in advance!
  11. I like idea 1 - will explore that. Idea 2 I don't think is necessary - even technophobes know how to copy/paste text if they want to duplicate it.
  12. @joshuag, currently when an event has no start time or end time entered, Recurme populates "time" and "timeEnd" with "12:00 am". This makes it difficult to distinguish between events that have those fields empty (can often be the case for end time in particular) and events that happen to actually have 12:00 am entered as their start time or end time. Do you think you could populate "time" and "timeEnd" with "false" or something else recognisable if start time or end time is left empty for an event?
  13. Remove Blocks A textformatter module for ProcessWire that removes blocks of text/markup between configurable delimiters from output. This allows you to "comment out" blocks of text/markup so they remain present in the field but are not shown in the front-end output. This can be handy if content needs to be removed temporarily and will later be reinstated. Or you could use a commented block as a placeholder to indicate to an editor where some content should be added. Installation Install the Remove Blocks module. Configure the open and close delimiters if needed. The default open delimiter is {{ and the default close delimiter is }}. Tip: don't use delimiter characters that CKEditor will encode to HTML entities, e.g. >. Usage Add the Remove Blocks textformatter to one or more fields. Add the open and close delimiters around any content that you want to be removed from output. https://github.com/Toutouwai/TextformatterRemoveBlocks http://modules.processwire.com/modules/textformatter-remove-blocks/
  14. There is no hookable method especially for images inserted in a CKEditor field. But two options: 1. Use/code a textformatter module to manipulate the image tags within a field. This approach has the advantage that you don't have to mess around with your field settings to make sure the classes and attributes you want to add are allowed by ACF and HTML Purifier. There is even an existing textformatter module you can use: https://modules.processwire.com/modules/textformatter-srcset/ 2. Hook the saving of pages (e.g. Pages::saveReady) and modify the markup in your CKEditor field before it is saved. The approach would be similar to the textformatter option - you parse the markup to identify the image tags (using regex or a DOM parser such as DOM) and use the src attribute to get the relevant Pageimage to create your different sizes from. The difference is that this parsing/modification is done whenever the page is saved rather whenever the field value is loaded. Option 2 is more efficient, but I would tend to go for option 1 because it's not destructive and gives greater flexibility to make changes down the line. And maybe that existing textformatter module is just what you need.
  15. My vote goes for the status quo - no need to change output formatting or have an indicator IMO. I think the best thing is to get into the habit of always turning output formatting off before setting any value to a page (I tend to do it individually for the page I'm changing rather than for all pages). I think it's simplest to follow that rule everywhere - frontend, backend, in a module, etc. It's just a single line of code, and if output formatting is already off for any reason then it doesn't do any harm to explicitly set it off to be sure. If Tracy was to get involved in output formatting I think it would add confusion, particularly for new users who are still getting to grips with output formatting.
  16. Hooking ProcessPageSearch::findReady might be better because it's more specific to autocomplete and the method looks like it exists for just this sort of purpose. $wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) { $selector = $event->arguments(0); // Manipulate $selector as needed... }); /** * Hookable function to optionally modify selector before it is sent to $pages->find() * * Not applicable when Lister is handling the search/render. * * #pw-hooker * * @param string $selector Selector that will be used to find pages * @return string Must return the selector (optionally modified) * */ public function ___findReady($selector) { return $selector; }
  17. PW cannot handle circular references in Page Reference fields: https://github.com/processwire/processwire-issues/issues/152 https://github.com/processwire/processwire-issues/issues/572
  18. I opened a request on GitHub: https://github.com/processwire/processwire-requests/issues/226 @Macrura, I noticed this post of yours from a while ago: Were you only able to achieve the data attributes by disabling HTML Purifier on the CKEditor field?
  19. Yes, but it can be set by anyone linking to your site, so I think it definitely needs to be verified. If you just display the event date from the GET variable without verifying it then any third party can create a link to your site that causes your event page to display any date of their choosing. I solved it like this: $req_date = $input->get->int('date'); $event = $recurme->find($req_date, $req_date, "id=$page->id")->first(); if(!$event) { // $req_date is invalid for this event // ... } rrule-gui.js needs updating in this package to account for the timeEndUnix property. Not quite. You are first passing the string through date()... // ... if(date('U',$date)){ $date = $date; } // ... ...which does not handle those example date strings correctly.
  20. The $dateFrom and $dateTo arguments aren't working with some date strings that are valid for strtotime(). // Not working $events = $recurme->find('01-08-2018', '31-08-2018'); // Also not working $events = $recurme->find('08/01/2018', '08/31/2018'); These are being converted by Recurme to the timestamp for "January 1 1970".
  21. @joshuag, is there a Recurme method to find the next n events, regardless of date? For example, if I want a listing showing the next 5 events. Another thing: the docs say that the $dateFrom and $dateTo arguments for the find() method are optional, but when I leave either of them out no events are returned. Edit: I worked this one out by looking at the module code. $dateFrom and $dateTo are set to today if not supplied (I was expecting no $dateFrom/$dateTo limits if not supplied). $events = $recurme->find(); // empty PageArray $events = $recurme->find('today'); // empty PageArray
  22. This is already possible since PW 3.0.87: https://processwire.com/blog/posts/pw-3.0.87/#new-field-template-context-settings
  23. @joshuag, when I do... $event = $recurme->event($page); ...where $page is a page with a Recurme field on it, I get the following notice: Undefined property: stdClass::$timeEndUnix in ...\site\modules\FieldtypeRecurme\MarkupRecurme.module:851 MarkupRecurme.module version 103. Is this the latest version? I think maybe you don't always bump up the version number as you make fixes? As I've mentioned to you previously via PM, when I purchased Recurme I never received a link to download the latest version so I'm always wondering if I'm using an older version with bugs that have already been fixed. Also, I think one area where the documentation needs more detail is how event data should be accessed when you are viewing an event page itself. For example, the calendar creates links to events like this: /path/to/eventpage/?date=1534366800 The date variable is a timestamp for the relevant date, but how is that to be used? Does the Recurme module use this so we can get the equivalent date somehow from $event? Or are we meant to just get that timestamp from $input and convert it to a date, in which case how do we validate that the timestamp is in fact a valid date for that event?
  24. Maybe you are just missing an echo? <div><?php echo $page->rockgrid; ?></div>
  25. $pages->find() returns a PageArray, and you can't get the URL of a PageArray. I think you want $pages->get() or $pages->findOne(). I recommend checking that a real page is returned before trying to get its URL. $p = $pages->findOne("template=categories-template, artcategories=2"); if($p->id) { // Page was found, output its URL, etc } else { // No page found, so deal with this somehow }
×
×
  • Create New...