Skip to content

Commit

Permalink
Prevent PHP notices, and begin to port other metatag submodules.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jen Lampton committed Dec 24, 2017
1 parent 109e727 commit 238aece
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 208 deletions.
94 changes: 48 additions & 46 deletions metatag_dc/metatag_dc.metatag.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,59 @@
*/
function metatag_dc_metatag_bundled_config_alter(array &$configs) {
foreach ($configs as &$config) {
switch ($config->instance) {
case 'global':
$config->config += array(
'dcterms.format' => array('value' => 'text/html'),
'dcterms.identifier' => array('value' => '[current-page:url:absolute]'),
'dcterms.title' => array('value' => '[current-page:title]'),
'dcterms.type' => array('value' => 'Text'),
);
break;
if (isset($config['instance'])) {
switch ($config['instance']) {
case 'global':
$config['config'] += array(
'dcterms.format' => array('value' => 'text/html'),
'dcterms.identifier' => array('value' => '[current-page:url:absolute]'),
'dcterms.title' => array('value' => '[current-page:title]'),
'dcterms.type' => array('value' => 'Text'),
);
break;

case 'global:frontpage':
$config->config += array(
'dcterms.description' => array('value' => '[site:slogan]'),
'dcterms.identifier' => array('value' => '[site:url]'),
'dcterms.title' => array('value' => '[site:name]'),
);
break;
case 'global:frontpage':
$config['config'] += array(
'dcterms.description' => array('value' => '[site:slogan]'),
'dcterms.identifier' => array('value' => '[site:url]'),
'dcterms.title' => array('value' => '[site:name]'),
);
break;

// On error pages point everything to the homepage.
case 'global:403':
case 'global:404':
$config->config += array(
'dcterms.identifier' => array('value' => '[site:url]'),
'dcterms.title' => array('value' => '[site:name]'),
);
break;
// On error pages point everything to the homepage.
case 'global:403':
case 'global:404':
$config['config'] += array(
'dcterms.identifier' => array('value' => '[site:url]'),
'dcterms.title' => array('value' => '[site:name]'),
);
break;

case 'node':
$config->config += array(
'dcterms.creator' => array('value' => '[node:author]'),
'dcterms.date' => array('value' => '[node:created:custom:Y-m-d\TH:iP]'),
'dcterms.description' => array('value' => '[node:summary]'),
'dcterms.language' => array('value' => '[node:language]'),
'dcterms.title' => array('value' => '[node:title]'),
);
break;
case 'node':
$config['config'] += array(
'dcterms.creator' => array('value' => '[node:author]'),
'dcterms.date' => array('value' => '[node:created:custom:Y-m-d\TH:iP]'),
'dcterms.description' => array('value' => '[node:summary]'),
'dcterms.language' => array('value' => '[node:language]'),
'dcterms.title' => array('value' => '[node:title]'),
);
break;

case 'taxonomy_term':
$config->config += array(
'dcterms.description' => array('value' => '[term:description]'),
'dcterms.title' => array('value' => '[term:name]'),
);
break;
case 'taxonomy_term':
$config['config'] += array(
'dcterms.description' => array('value' => '[term:description]'),
'dcterms.title' => array('value' => '[term:name]'),
);
break;

case 'user':
$config->config += array(
'dcterms.creator' => array('value' => '[user:name]'),
'dcterms.date' => array('value' => '[user:created:custom:Y-m-d\TH:iP]'),
'dcterms.title' => array('value' => '[user:name]'),
);
break;
case 'user':
$config['config'] += array(
'dcterms.creator' => array('value' => '[user:name]'),
'dcterms.date' => array('value' => '[user:created:custom:Y-m-d\TH:iP]'),
'dcterms.title' => array('value' => '[user:name]'),
);
break;
}
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions metatag_dc_advanced/metatag_dc_advanced.metatag.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
*/
function metatag_dc_advanced_metatag_bundled_config_alter(array &$configs) {
foreach ($configs as &$config) {
switch ($config->instance) {
case 'node':
$config->config += array(
'dcterms.modified' => array('value' => '[node:changed:custom:Y-m-d\TH:iP]'),
);
break;
if (isset($config['instance'])) {
switch ($config['instance']) {
case 'node':
$config['config'] += array(
'dcterms.modified' => array('value' => '[node:changed:custom:Y-m-d\TH:iP]'),
);
break;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion metatag_favicons/metatag_favicons.metatag.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
function metatag_favicons_metatag_bundled_config_alter(&$config) {
$favicon = metatag_favicons_get_theme_favicon();
if (!empty($favicon)) {
$config['global']->config['shortcut icon'] = array('value' => $favicon);
$config['global']['config']['shortcut icon'] = array('value' => $favicon);
}
}

Expand Down
86 changes: 44 additions & 42 deletions metatag_google_plus/metatag_google_plus.metatag.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,56 @@
*/
function metatag_google_plus_metatag_bundled_config_alter(array &$configs) {
foreach ($configs as &$config) {
switch ($config->instance) {
case 'global':
$config->config += array(
'itemprop:name' => array('value' => '[current-page:title]'),
);
break;
if (isset($config['instance'])) {
switch ($config['instance']) {
case 'global':
$config['config'] += array(
'itemprop:name' => array('value' => '[current-page:title]'),
);
break;

case 'global:frontpage':
$config->config += array(
'itemprop:name' => array('value' => '[site:name]'),
'itemprop:description' => array('value' => '[site:slogan]'),
);
break;
case 'global:frontpage':
$config['config'] += array(
'itemprop:name' => array('value' => '[site:name]'),
'itemprop:description' => array('value' => '[site:slogan]'),
);
break;

// On error pages point everything to the homepage.
case 'global:403':
case 'global:404':
$config->config += array(
'itemprop:name' => array('value' => '[site:name]'),
);
break;
// On error pages point everything to the homepage.
case 'global:403':
case 'global:404':
$config['config'] += array(
'itemprop:name' => array('value' => '[site:name]'),
);
break;

case 'node':
$config->config += array(
'itemprop:description' => array('value' => '[node:summary]'),
'itemprop:name' => array('value' => '[node:title]'),
'itemtype' => array('value' => 'Article'),
);
break;
case 'node':
$config['config'] += array(
'itemprop:description' => array('value' => '[node:summary]'),
'itemprop:name' => array('value' => '[node:title]'),
'itemtype' => array('value' => 'Article'),
);
break;

case 'taxonomy_term':
$config->config += array(
'itemprop:description' => array('value' => '[term:description]'),
'itemprop:name' => array('value' => '[term:name]'),
);
break;
case 'taxonomy_term':
$config['config'] += array(
'itemprop:description' => array('value' => '[term:description]'),
'itemprop:name' => array('value' => '[term:name]'),
);
break;

case 'user':
$config->config += array(
'itemprop:name' => array('value' => '[user:name]'),
'itemtype' => array('value' => 'Person'),
);
if (variable_get('user_pictures')) {
$config->config += array(
'itemprop:image' => array('value' => '[user:picture:url]'),
case 'user':
$config['config'] += array(
'itemprop:name' => array('value' => '[user:name]'),
'itemtype' => array('value' => 'Person'),
);
}
break;
if (variable_get('user_pictures')) {
$config['config'] += array(
'itemprop:image' => array('value' => '[user:picture:url]'),
);
}
break;
}
}
}
}
Expand Down
32 changes: 17 additions & 15 deletions metatag_hreflang/metatag_hreflang.metatag.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,25 @@ function metatag_hreflang_metatag_bundled_config_alter(array &$configs) {
}

foreach ($configs as &$config) {
switch ($config->instance) {
case 'node':
// The x-default should default to the source language.
$config->config += array(
'hreflang_xdefault' => array('value' => '[node:source:url]'),
);
if (isset($config['instance'])) {
switch ($config['instance']) {
case 'node':
// The x-default should default to the source language.
$config['config'] += array(
'hreflang_xdefault' => array('value' => '[node:source:url]'),
);

// Add all of the other hreflang values.
$languages = language_list('enabled');
if (!empty($languages[1])) {
foreach (array_keys($languages[1]) as $langcode) {
$config->config += array(
'hreflang_' . $langcode => array('value' => '[node:url-' . $langcode . ']'),
);
// Add all of the other hreflang values.
$languages = language_list('enabled');
if (!empty($languages[1])) {
foreach (array_keys($languages[1]) as $langcode) {
$config['config'] += array(
'hreflang_' . $langcode => array('value' => '[node:url-' . $langcode . ']'),
);
}
}
}
break;
break;
}
}
}
}
Expand Down
Loading

0 comments on commit 238aece

Please sign in to comment.