BobRay/newspublisher

skip non-attached TVs

mgraham opened this issue · 2 comments

We are using NewsPublisher to edit multiple resources. Some of the resources use different templates, and the templates have access to different template variables.

In a nutshell, some resources will have access to the 'seokeywords' TV, and some will not.

We're using a NewsPublisher snippet like this:

[[!NewsPublisher?
&parentid=7
&show=pagetitle,longtitle,introtext,published,content,seokeywords
&template=parent
]]

Currently, this snippet fails on resources that does not have access to the "seokeywords" TV.

We would like to request an option that makes NewsPublisher simply skip the non-attached TVs. That would allow us to use the same editing snippet call for multiple documents, and would simplify our site structure considerably.

Michael

It's tricky. I think if you comment out these two lines around line 803 of newspublisher.class.php, it will let you edit those documents. The extra TVs may show up in the form, though -- I'm not sure. I'll try to find time to look into it further.

if (! $found) {
// $this->setError($this->modx->lexicon('np_not_our_tv') . ' Template: ' . $this->template . ' ---- TV: ' . $tvNameOrId);
// return null;
} else {
$this->allTvs[] = $tvObj;
}

BTW, you can have more than one NewsPublisher page and use different fields in each &show tag. If you explicitly set &np_id in the NpEdiThisButton tag, you can send them to the NewsPublisher page with the appropriate &show fields and avoid the problem. You can also use a TV to designate the correct np_id value. See the tutorial section on Multiple NewsPublisher Pages.

Fixed in a later version.