-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base Schema.org Implementation #6
Conversation
Update drone signature
Fix code style
…s/gsoc22_schema.org into schema-system-plugin-test
* | ||
* @since 4.0.0 | ||
*/ | ||
protected function updateSchemaForm($data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "update" mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will update the Schema form with prefilled data from database if article already has some data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document this in the method phpdoc
plugins/schemaorg/recipe/recipe.php
Outdated
* | ||
* @return boolean | ||
*/ | ||
public function onSchemaBeforeSave(AbstractEvent $event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to have special function names for listeners. Offer a default subscriber map to [onSchedmaBeforeSave
=> saveSchema
] so the schema plugin can use it in directly in getSubscribedEvents()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
* | ||
* @since 4.0.0 | ||
*/ | ||
protected function saveSchema(AbstractEvent $event, $form) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use a more descriptive name. An example: storeSchemaToStandardLocation()
-- anything that tells the user our trait function saves the schema to the standard location.
…ions and updated schema form
* | ||
* @since 4.0.0 | ||
*/ | ||
protected function addSchemaType(Form $form, $type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return type annotation
* | ||
* @since 4.0.0 | ||
*/ | ||
protected function saveSchema($event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return type annotation
* | ||
* @return boolean | ||
*/ | ||
protected function cleanupIndividualSchema(Registry $schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a @todo
, please mention it in a code comment.
* | ||
* @return boolean | ||
*/ | ||
protected function changeDurationFormat(Registry $schema, $durationKeys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A function name like normalizeDurationsToISO
could be more indicative of its function.
* | ||
* @return boolean | ||
*/ | ||
protected function changeDurationFormat(Registry $schema, $durationKeys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type annotation for second param and return.
* | ||
* @return array | ||
*/ | ||
protected function convertToArray(Registry $schema, $repeatableFields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify why we need this function and document an example of the transformation it's performing in the phpdoc comment.
* | ||
* @return boolean | ||
*/ | ||
public function onSchemaAfterSave(AbstractEvent $event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not need the onXXX
functions. Map the functions to events in getSubscribedEvents()
instead.
} | ||
} | ||
} | ||
$schema->toArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are returning the schema as an array?
a5a2ed8
to
cfff800
Compare
Service interface
Organization schema
Pull Request for Issue #5