Skip to content

Commit

Permalink
[2.5.19] Add feature configure Open Graph Visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Aug 27, 2022
1 parent 481a225 commit e8eeb5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions framework/forms/og.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
label="ASTROID_IMAGE"
default=""
/>
<field showon="astroid_opengraph_menuitem:1" name="astroid_og_visibility" type="list" label="ASTROID_OPENGRAPH_VISIBILITY_LABEL" default="currentPage">
<option value="currentPage">ASTROID_BANNER_VISIBILITY_OPTIONS_CURRENT_PAGE</option>
<option value="allPage">ASTROID_BANNER_VISIBILITY_OPTIONS_ALL</option>
</field>
</fieldset>
</fields>
</form>
6 changes: 6 additions & 0 deletions framework/library/astroid/Component/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public static function meta()
if (empty($enabled)) {
return;
}
$astroid_og_visibility = $params->get('astroid_og_visibility', "currentPage");
if ($astroid_og_visibility == "currentPage") {
if ((isset($item->query['option']) && $item->query['option'] != $app->input->get('option', '')) || (isset($item->query['view']) && $item->query['view'] != $app->input->get('view', '')) || (isset($item->query['layout']) && $item->query['layout'] != $app->input->get('layout', ''))) {
return;
}
}

$fb_id = $template_params->get('article_opengraph_facebook', '');
$tw_id = $template_params->get('article_opengraph_twitter', '');
Expand Down
1 change: 1 addition & 0 deletions language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ ASTROID_AUTHOR_INFO="Author Info"
ASTROID_ARTICLE_RATING="Article Rating"
ASTROID_OPENGRAPH_TITLE_DESC="Enter the title of your page, content, etc. as you would like for it to appear when displayed on Facebook or Twitter."
ASTROID_OPENGRAPH_DESCRIPTION="OG Description"
ASTROID_OPENGRAPH_VISIBILITY_LABEL="OG Visibility"
ASTROID_IMAGE="Image"

ASTROID_ARTICLE_OPTIONS_BADGE_2_LBL="Editor's Choice"
Expand Down

0 comments on commit e8eeb5e

Please sign in to comment.