-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
253 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
return [ | ||
'escape_element' => [ | ||
'id' => 'escape_element', | ||
'title' => __('Escape element', 'openpub-base'), | ||
'post_types' => ['openpub-item'], | ||
'context' => 'normal', | ||
'priority' => 'low', | ||
'autosave' => true, | ||
'fields' => [ | ||
'settings' => [ | ||
[ | ||
'name' => __('Enable escape element', 'openpub-base'), | ||
'desc' => __('Show escape element on portal page.', 'openpub-base'), | ||
'id' => 'escape_element_active', | ||
'type' => 'radio', | ||
'options' => [ | ||
'1' => __('Yes', 'openpub-base'), | ||
'0' => __('No', 'openpub-base'), | ||
], | ||
'std' => '0', | ||
], | ||
] | ||
] | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace OWC\OpenPub\Base\RestAPI\ItemFields; | ||
|
||
use OWC\OpenPub\Base\Models\Item; | ||
use OWC\OpenPub\Base\Support\CreatesFields; | ||
use WP_Post; | ||
|
||
/** | ||
* Adds escape element field to the output. | ||
*/ | ||
class EscapeElementField extends CreatesFields | ||
{ | ||
/** | ||
* The condition for the creator. | ||
* | ||
* @return callable | ||
*/ | ||
protected function condition(): callable | ||
{ | ||
return function () { | ||
return $this->plugin->settings->useEscapeElement(); | ||
}; | ||
} | ||
|
||
/** | ||
* Create the identifications field for a given post. | ||
* | ||
* @param WP_Post $post | ||
* | ||
* @return bool | ||
*/ | ||
public function create(WP_Post $post): bool | ||
{ | ||
$itemModel = new Item($post->to_array()); | ||
|
||
return $itemModel->getEscapeElement(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.