In the Feed: Style options, the Copyright field is a text field, which doesn't allow the data to be driven through views data. Copyright should be treated like all other fields.

CommentFileSizeAuthor
#3 podcast-copyright_from_view.patch1.43 KBgeoffreyr

Issue fork podcast-3033706

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Winn created an issue. See original summary.

e0ipso’s picture

Thanks for this report @winn. I was tempted to implement this on the initial implementation. I discarded the idea because I didn't think it make a lot of sense to manage different copyrights from the same view. I thought that even if a single site managed many podcasts, different copyrights would probably mean different views.

Is that not your use case? If it it not, have you tried altering the view with the corresponding hooks?

geoffreyr’s picture

StatusFileSize
new1.43 KB

I actually have a use case where I'd need this; where I have a single Drupal installation controlling multiple podcasts, and Podcast and Podcast Episode are treated as individual content types. I've attached my patch that implements this.

geoffreyr’s picture

Status: Active » Needs review
e0ipso’s picture

I would still like to support the old behavior, otherwise we'll break existing sites.

I'm torn on how to best implement this.

shane birley’s picture

In my use case, I have a single Drupal site that produces six different podcasts -- in which all information for feeds and the display pages are being produced by a single view.

Does it not make sense for this field to be treated like all others but implement a feature in the selection for a text field or "custom text".

Just a thought.

jrearick’s picture

I'm finding a need for this as well. I'm making one view that manages multiple podcast shows and may need different copyrights. I don't know if it is feasible to do with what @Shane Birley suggested and offer the choice of the existing plaintext or field option for copyright (and maybe generator too?). Maybe in a 2.x version of the module it could be implemented as fields?

I might just take this patch and run with it for now.

rodrigoaguilera’s picture

Status: Needs review » Needs work

The points raised by @e0ipso are quite important as applying this would break the copyright field for existing sites.

I see two options:

  • writing an update hook that goes through all views re-configuring all that have a Podcast feed and a copyright field filled creating a static field with the value. Quite some work
  • Release a new version of the module with all those values that can't be mapped as views fields like copyright to use a views field. This can also hurt usability since you have to create a views field for every static value

What do you think?

rodrigoaguilera’s picture

Version: 8.x-1.0-beta2 » 8.x-1.x-dev

I just thought about a pattern that is used in the webform module when you are filling the values that a handler is going to use, for example the email address that receives the submission. There is a select with the fields available and an additional option to make it static.

I think this is way better than the two options from my previous comment, no need for update hooks.
I am open to commit a patch that implements that idea.

dww’s picture

I also need this. My use case is that I'd rather use Twig to define the copyright, so the year can be dynamic. E.g.:

2007-{{ "now"|date('Y') }} Whatever The Owner Is

A dynamic year is essential, since no one wants to go in and update Views config every year. 😅 However, it's impossible at the moment.

I'll probably work on fixing up the patch early this week...

Thanks,
-Derek

pcambra made their first commit to this issue’s fork.

pcambra’s picture

Status: Needs work » Needs review

What @rodrigoaguilera mentions is what I thought some of the fields should be the first time I installed the module: a select or other. I've added a dependency to https://www.drupal.org/project/select_or_other so we can leverage an existing and establish form element, I've added support for the copyright field (we might want to add additional issues for other fields), and handled the validation/form handling for elements that are the special case of _field.

I didn't want to change the module drastically, I like the _field distinction still, we might want to change it for 2.x or something, so I've added an update that changes the copyright to copyright_field, the style form should be generic enough to handle existing values as "other" from the select or other.

Ready for review, I think I need a second pair of eyes on this one :)

rodrigoaguilera’s picture

Status: Needs review » Needs work

The code looks good to me. The only bit I am missing is some lines in the post_update that enable the new module. Or does Drupal enables dependencies automatically now?

pcambra’s picture

Status: Needs work » Needs review

That's a great point @rodrigoaguilera, I've just fixed that.

  • pcambra committed ac38a930 on 8.x-1.x
    Issue #3033706 by pcambra: Update copyright to be a select or other field

  • pcambra committed 7a03d8f1 on 8.x-1.x
    Issue #3033706 by geoffreyr: Show copyright should be a field
pcambra’s picture

Status: Needs review » Fixed

Merged, thanks all!

Anonymous’s picture

Status: Fixed » Needs work

Posting this here as this appears to b related to the change introduced here and the Select (or other module.

In Views, when viewing the settings for the “Podcast RSS Feed” format settings, PHP errors are thrown.

This occurs if pointing the Copyright to a field or using the “Other” option to directly enter text.

Warning: Undefined array key "#type" in Drupal\podcast\Plugin\views\style\Rss->buildOptionsForm() (line 255 of /public_html/modules/contrib/podcast/src/Plugin/views/style/Rss.php)
#0 /public_html/core/includes/bootstrap.inc(164): _drupal_error_handler_real(2, 'Undefined array...', '/...', 255)
#1 /public_html/modules/contrib/podcast/src/Plugin/views/style/Rss.php(255): _drupal_error_handler(2, 'Undefined array...', '/...', 255)
#2 /public_html/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(1690): Drupal\podcast\Plugin\views\style\Rss->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
#3 /public_html/core/modules/views/src/Plugin/views/display/PathPluginBase.php(437): Drupal\views\Plugin\views\display\DisplayPluginBase->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
#4 /public_html/core/modules/views/src/Plugin/views/display/Feed.php(303): Drupal\views\Plugin\views\display\PathPluginBase->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
#5 /public_html/core/modules/views_ui/src/Form/Ajax/Display.php(74): Drupal\views\Plugin\views\display\Feed->buildOptionsForm(Array, Object(Drupal\Core\Form\FormState))
#6 [internal function]: Drupal\views_ui\Form\Ajax\Display->buildForm(Array, Object(Drupal\Core\Form\FormState))
#7 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array(Array, Array)
#8 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm('views_ui_edit_d...', Object(Drupal\Core\Form\FormState))
#9 /public_html/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(215): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#10 /public_html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}()
#11 /public_html/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(217): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#12 /public_html/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(127): Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#13 /public_html/core/modules/views_ui/src/Form/Ajax/Display.php(46): Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object(Drupal\views_ui\ViewUI), 'feed_1', 'ajax')
#14 [internal function]: Drupal\views_ui\Form\Ajax\Display->getForm(Object(Drupal\views_ui\ViewUI), 'feed_1', 'ajax', 'style_options')
#15 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#16 /public_html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#18 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#19 /vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 /vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#21/public_html/modules/contrib/redirect_after_login/src/RedirectMiddleware.php(44): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\redirect_after_login\RedirectMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /public_html/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(209): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /public_html/core/modules/ban/src/BanMiddleware.php(50): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /public_html/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#33 {main}
Warning: Undefined array key "#other_option" in Drupal\select_or_other\Element\ElementBase::addSelectField() (line 141 of /public_html/modules/contrib/select_or_other/src/Element/ElementBase.php)
#0 /public_html/core/includes/bootstrap.inc(164): _drupal_error_handler_real(2, 'Undefined array...', '/...', 141)
#1 /public_html/modules/contrib/select_or_other/src/Element/ElementBase.php(141): _drupal_error_handler(2, 'Undefined array...', '/...', 141)
#2 /public_html/modules/contrib/select_or_other/src/Element/ElementBase.php(112): Drupal\select_or_other\Element\ElementBase::addSelectField(Array)
#3 /public_html/modules/contrib/select_or_other/src/Element/Select.php(20): Drupal\select_or_other\Element\ElementBase::processSelectOrOther(Array, Object(Drupal\Core\Form\FormState), Array)
#4 [internal function]: Drupal\select_or_other\Element\Select::processSelectOrOther(Array, Object(Drupal\Core\Form\FormState), Array)
#5 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(1013): call_user_func_array(Array, Array)
#6 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(1076): Drupal\Core\Form\FormBuilder->doBuildForm('views_ui_edit_d...', Array, Object(Drupal\Core\Form\FormState))
#7 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(1076): Drupal\Core\Form\FormBuilder->doBuildForm('views_ui_edit_d...', Array, Object(Drupal\Core\Form\FormState))
#8 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(1076): Drupal\Core\Form\FormBuilder->doBuildForm('views_ui_edit_d...', Array, Object(Drupal\Core\Form\FormState))
#9 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(579): Drupal\Core\Form\FormBuilder->doBuildForm('views_ui_edit_d...', Array, Object(Drupal\Core\Form\FormState))
#10 /public_html/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('views_ui_edit_d...', Array, Object(Drupal\Core\Form\FormState))
#11 /public_html/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(215): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#12 /public_html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}()
#13 /public_html/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(217): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#14 /public_html/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(127): Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#15 /public_html/core/modules/views_ui/src/Form/Ajax/Display.php(46): Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object(Drupal\views_ui\ViewUI), 'feed_1', 'ajax')
#16 [internal function]: Drupal\views_ui\Form\Ajax\Display->getForm(Object(Drupal\views_ui\ViewUI), 'feed_1', 'ajax', 'style_options')
#17 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#18 /public_html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#20 /public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#21 /vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#23 /public_html/modules/contrib/redirect_after_login/src/RedirectMiddleware.php(44): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\redirect_after_login\RedirectMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /public_html/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(209): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /public_html/core/modules/ban/src/BanMiddleware.php(50): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /public_html/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#35 {main}

Drupal: 10.2.4
PHP: 8.1.27
Podcast (using Views): 8.x-1.9
Select (or other: 4.1.0

pcambra’s picture

Status: Needs work » Fixed

Those are warnings, not errors, I'll open a separate task for these

pcambra’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.