Jump to content

nabo

Members
  • Posts

    125
  • Joined

  • Last visited

Everything posted by nabo

  1. Hi @Zeka thanks, but in this case I think I will find all pages that with template store and repeater_field.hours = 10. I come with an example. These are the fields in my repeater: days hours I'm in the store page and I want to find only hours related to the day, for example friday. The example you provide me is not what I need
  2. Hi I've got a template for a store and I use repeater for opening hours. When I'm on the store page I would like to search inside this repeater to find the hours related to a precise day. Is it possible with selectors?
  3. Hello I wrote a function that read files tree from a folder and rebuild the structure with PW templates. I tested it on a frontend template and it works perfectly. Now I'd like to call this function inside backend by simply clicking on a link on the main menu. How can I achieve this? thanks
  4. I meant, not create, but choose from a list like other attributes. Anyway I solved with class as you wrote.
  5. Hi I'm implementing uikit on a theme. It can be useful (and in my case necessary) the opportunity to add data-attributes to ProcessPageEditLink, with or without values. Example <a href="my-image.jpg" data-uk-lightbox>...</a> <a href="" data-uk-lightbox="{group:'my-group'}">...</a>
  6. Thanks for the tip, but I was not able to reach my goal. I edited LanguageFunction adding a new condition
  7. Hello is there a way to avoid default language in TRANSLATABLE STRINGS if the value of the language set in frontend is empty? $this->_("Hello"); If there's no translation in other language I wouldn't see "Hello"
  8. Solved!!! Hope can be useful This is the class class SeoTemplate extends WireData implements Module { public static function getModuleInfo() { return array( "title" => "SeoTemplate", "summary" => "Module for add seo_rules field to template.", "version" => "0.0.1", "autoload" => true ); } public function init() { $this->addHookAfter("ProcessTemplate::buildEditForm", $this, "appendFieldToForm"); $this->addHookBefore("ProcessTemplate::executeSave", $this, "saveSeoRuleField"); } public function appendFieldToForm(HookEvent $event) { $languages = $this->wire('languages'); $template = $event->arguments[0]; $form = $event->return; $field = $this->modules->get("InputfieldText"); $field->attr('id+name', 'seo_rules'); $field->attr('value', $template->seo_rules); if($languages) { $field->useLanguages = true; foreach($languages as $language) $field->set('value' . $language->id, $template->get('seo_rules' . $language->id)); } $field->label = $this->_('Seo rule'); $field->description = $this->_('If you want to add a custom rule to MarkupSEO'); $field->notes = $this->_('To define a variable use {title} syntax'); $form->insertAfter($field, $form->tags); $event->return = $form; } public function saveSeoRuleField($event) { $template = $this->templates->get($this->input->post->id); $template->set('seo_rules', $this->input->post->seo_rules); $languages = $this->wire('languages'); if($languages) { foreach($languages as $language) { $template->set('seo_rules'.$language->id, $this->input->post->{"seo_rules__$language->id"}); } } } }
  9. Thanks @kixe. New field is perfectly loaded after tags in advanced tab. But when I try to save I've got an error Error: Uncaught Error: Call to a member function set() on null on line $event->object->template->set('seo_rules', $this->input->post->seo_rules); Error: Uncaught Error: Call to a member function set() on null in
  10. thanks @kixe as you can see my code is very bad, thanks for suggestions
  11. Thank you @kixe! I've seen that hook and I begun to code a little snippet... public function init() { $this->addHookAfter("ProcessTemplate::buildEditForm", $this, "appendFieldToForm"); } public function appendFieldToForm($event) { $frm = $event->return; $field = $this->modules->get("InputfieldTextLanguage"); $field->attr('name', 'seo_rule'); $field->attr('value', $template->seo_rule); $field->label = $this->_('Seo rule'); $field->description = $this->_('If you want to add a custom rule to MarkupSEO'); // Description for field tags $field->notes = $this->_('To define a variable use {title} syntax'); $form = $frm->find('id=advanced')->first(); $form->insertAfter($field,"tags"); } But when I try to install, viewing a template return me an error on line 35 $field->attr('name', 'seo_rule').... maybe because field doesn't exist?! Don't know how to create
  12. Hello I would like to add a custom field to template to extend a functionality of MarkupSEO module. In that module there's a very nice setting that lets you configure a title structure for <title> tag, for example {title}, {sitename} etc. But this configuration is valid for every template. I thought that it would be better if I can configure this setting by template: in fact for product template I could use {title}, {category} and so on to create a dynamic title. I began to write a module, but I stopped early because of an error. I think this is why I am at the beginning of PW experience and I missed something. I was inspired by this module https://github.com/BitPoet/TemplateParent... the goal is to have two InputfieldTextLanguage (title and description) under the Advanced TAB in Edit Template. Any idea or suggestion are appreciated, thanks!
  13. I installed the ProcessRedirects module from @apeisa It's a simple and brilliant module and work perfectly. I try to extend it adding a multi-language functionality. I add this rows to the module to create select options with current active languages if (wire('modules')->isInstalled('LanguageSupport')){ $field = $this->modules->get("InputfieldSelect"); $field->label = 'Language'; $field->attr('id+name','redirect_language'); $field->addOption(''); foreach(wire('languages') as $l) $field->addOption($l->id, $l->title); $form->add($field); } I would like to select a page, than choose a language to return correct language url For example, if I choose the "About" page and the German language, the result must be "/de/uber/" Unfortunately javascript that bind "pageSelected" function return the default page url
×
×
  • Create New...