Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to generate preview URL for new records #574

Open
2 tasks done
peterkraume opened this issue Apr 26, 2024 · 0 comments · May be fixed by #575
Open
2 tasks done

Attempt to generate preview URL for new records #574

peterkraume opened this issue Apr 26, 2024 · 0 comments · May be fixed by #575

Comments

@peterkraume
Copy link
Contributor

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

I'm using the RecordUtility to add Yoast SEO fields to a custom table:

<?php

use YoastSeoForTypo3\YoastSeo\Utility\RecordUtility;

RecordUtility::configureForRecord('tx_foo_domain_model_usedhall')
    ->setGetParameters([
        ['tx_foo_detail', 'usedhall'],
    ])
    ->setTitleField('seo_title')
    ->setGeneratePageTitle(true)
    ->setDescriptionField('metadescription')
    ->setAddDescriptionField(true)
    ->setFieldsPosition('after:image_hint');

When I'm in an empty sys folder and try to create a new record, I directly end up with this error message:

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Trying to access array offset on value of type null in yoast_seo/Classes/Form/Element/SnippetPreview.php line 202

I debugged the SnippetPreview a little bit and it seem that the wrong record is queried:

$recordArray = BackendUtility::getRecord($this->table, $recordId);

In my case, the both parameters where the table name specified above and as $recordId the uid of my sys_folder was used.

Long story short: I think the main problem is, that EXT:yoast_seo tries to generate a preview URL for not yet existing record which doesn't make sense at all.

How can we reproduce this behavior?

  1. use RecordUtility::configureForRecord() for a custom table
  2. create an empty sys_folder
  3. create a new record of the above mentioned type

Technical info

  • TYPO3 version: 11.5
  • Yoast SEO version: 9.0.3
peterkraume added a commit to peterkraume/Yoast-SEO-for-TYPO3 that referenced this issue Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant