Skip to content

Commit

Permalink
Merge branch 'master' of github.com:numero2/contao-opengraph3
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyborn committed Dec 9, 2022
2 parents f03c879 + 53d0665 commit 751e8a2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Resources/contao/classes/OpenGraphCalendarEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class OpenGraphCalendarEvents {


/**
* Appends OpenGraph data from news articles
* Appends OpenGraph data from events
*
* @param $objModule
*/
public static function addModuleData( $objModule ): void {

$calendars = StringUtil::deserialize($objModule->cal_calendar, true);
$event = CalendarEventsModel::findPublishedByParentAndIdOrAlias(Input::get('auto_item'), $calendars);
$event = CalendarEventsModel::findPublishedByParentAndIdOrAlias((Input::get('auto_item') ?? ''), $calendars);

// Check if the calendar event could get loaded from the database
if (null === $event) {
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/classes/OpenGraphIsotope.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OpenGraphIsotope {
public static function addModuleData( $objModule ): void {

$objProduct = NULL;
$objProduct = Product::findAvailableByIdOrAlias( Input::get('auto_item') );
$objProduct = Product::findAvailableByIdOrAlias( (Input::get('auto_item') ?? '') );

if( null !== $objProduct ) {

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/classes/OpenGraphNews.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function addModuleData( $objModule ): void {
$newsArchives = StringUtil::deserialize($objModule->news_archives);

$objArticle = NULL;
$objArticle = NewsModel::findPublishedByParentAndIdOrAlias(Input::get('auto_item'), $newsArchives);
$objArticle = NewsModel::findPublishedByParentAndIdOrAlias((Input::get('auto_item') ?? ''), $newsArchives);

if( null !== $objArticle ) {

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/classes/OpenGraphStoreLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function addModuleData( $objModule ): void {
$alias = Input::get('auto_item') ? Input::get('auto_item') : Input::get('store');

$objStore = NULL;
$objStore = StoresModel::findByIdOrAlias( $alias );
$objStore = StoresModel::findByIdOrAlias( ($alias ?? '') );

if( null !== $objStore ) {

Expand Down
10 changes: 7 additions & 3 deletions src/Resources/contao/widgets/OpenGraphProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,13 @@ protected function generateWidgetsDCA( $value=null ): array {

foreach( $value as $keyRow => $row ) {

if( !array_key_exists($row[0], $options) ){
unset($this->varValue[$keyRow]);
$removedValues = true;
if( !array_key_exists($row[0], $options) ) {

if( is_array($this->varValue) && array_key_exists($keyRow, $this->varValue) ) {
unset($this->varValue[$keyRow]);
$removedValues = true;
}

continue;
}

Expand Down

0 comments on commit 751e8a2

Please sign in to comment.