-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from 5am-code/dev
Dev for v0.6.0
- Loading branch information
Showing
68 changed files
with
1,582 additions
and
284 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
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,75 @@ | ||
<?php | ||
|
||
namespace FiveamCode\LaravelNotionApi\Entities\Blocks; | ||
|
||
use FiveamCode\LaravelNotionApi\Entities\Contracts\Modifiable; | ||
use FiveamCode\LaravelNotionApi\Entities\PropertyItems\RichText; | ||
|
||
/** | ||
* Class TextBlock | ||
* @package FiveamCode\LaravelNotionApi\Entities\Blocks | ||
*/ | ||
class BaseFileBlock extends Block implements Modifiable | ||
{ | ||
protected static final function createFileBlock(BaseFileBlock $fileBlock, string $url, string $caption = ""): BaseFileBlock | ||
{ | ||
$fileBlock->rawContent = [ | ||
'type' => 'external', | ||
'caption' => [ | ||
[ | ||
'type' => 'text', | ||
'text' => [ | ||
'content' => $caption | ||
] | ||
] | ||
], | ||
'external' => [ | ||
'url' => $url, | ||
] | ||
]; | ||
|
||
$fileBlock->fillContent(); | ||
|
||
return $fileBlock; | ||
} | ||
|
||
private string $hostingType = ""; | ||
private string $url = ""; | ||
private RichText $caption; | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
protected function fillFromRaw(): void | ||
{ | ||
parent::fillFromRaw(); | ||
$this->fillContent(); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
protected function fillContent(): void | ||
{ | ||
$this->hostingType = $this->rawContent['type']; | ||
$this->url = $this->rawContent[$this->hostingType]['url']; | ||
$this->caption = new RichText($this->rawContent['caption']); | ||
$this->content = $this->url; | ||
} | ||
|
||
public function getUrl() | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function getHostingType() | ||
{ | ||
return $this->hostingType; | ||
} | ||
|
||
public function getCaption() | ||
{ | ||
return $this->caption; | ||
} | ||
} |
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.