Skip to content

Commit

Permalink
Merge pull request #44 from jeis2497052/master
Browse files Browse the repository at this point in the history
fix some typos
  • Loading branch information
zerocrates committed Mar 5, 2021
2 parents 4236d73 + 5e94b72 commit 18cf3f7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions source/Reference/api/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ well. In your plugin class, register your resource using the
// For the resource URI: /api/your_resources/[:id]
$apiResources['your_resources'] = array(
// Module associated with your resource.
'module' => 'your-plugin-name',
'module' => 'your-plugin-name',
// Controller associated with your resource.
'controller' => 'your-resource-controller',
// Type of record associated with your resource.
Expand All @@ -33,9 +33,9 @@ well. In your plugin class, register your resource using the
'post', // POST request
'put', // PUT request (ID is required)
'delete', // DELETE request (ID is required)
),
),
// List of GET parameters available for your index action.
'index_params' => array('foo', 'bar'),
'index_params' => array('foo', 'bar'),
);
return $apiResources;
}
Expand Down Expand Up @@ -73,13 +73,13 @@ YourPlugin/models/Api/YourRecordType.php:
{
// Return a PHP array, representing the passed record.
}
// Set data to a record during a POST request.
public function setPostData(Omeka_Record_AbstractRecord $record, $data)
{
// Set properties directly to a new record.
}
// Set data to a record during a PUT request.
public function setPutData(Omeka_Record_AbstractRecord $record, $data)
{
Expand Down Expand Up @@ -144,7 +144,7 @@ should protect unauthorized API users from viewing non-public records:
{
$select = parent::getSelect();
$permissions = new Omeka_Db_Select_PublicPermissions('YourPlugin_YourRecords');
// Where "your_records" is the table alias, "owner_column" is the user column to check against,
// Where "your_records" is the table alias, "owner_column" is the user column to check against,
// and "public_column" is the permissions column to check against.
$permissions->apply($select, 'your_records', 'owner_column', 'public_column');
return $select;
Expand All @@ -165,30 +165,30 @@ You can extend the representations of existing resources by using the
public function filterApiExtendItems($extend, $args)
{
$item = $args['record'];
// For one resource:
$resourceId = $this->_db->getTable('YourResource')->findByItemId($item->id);
$extend['your_resources'] = array(
'id' => 1,
'url' => Omeka_Record_Api_AbstractRecordAdapter::getResourceUrl("/your_resources/{$resourceId->id}"),
'resource' => 'your_resources',
);
// Or, for multiple resources:
$extend['your_resources'] = array(
'count' => 10,
'url' => Omeka_Record_Api_AbstractRecordAdapter::getResourceUrl("/your_resources?item={$item->id}"),
'resource' => 'your_resources',
);
return $extend;
}
Note that the API enforces a pattern when extending a resource:

- ``id`` and ``url`` for a one-to-one relationship
- ``count`` and ``url`` for a one-to-many relationship
- ``resource`` is recommeded but not required
- ``resource`` is recommended but not required

All other keys pass through as custom data that may be used for the client's
All other keys pass through as custom data that may be used for the client's
convenience.
6 changes: 3 additions & 3 deletions source/Reference/api/requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Endpoint URL
Pagination
----------

For index requests using the defualt controller, pagination is set in
For index requests using the default controller, pagination is set in
the response's ``Link`` header:

::
Expand All @@ -37,8 +37,8 @@ is essentially identical to a ``GET`` response of the same resource.
This makes it possible to, for example, ``GET`` an item, modify the
representation directly and ``POST`` or ``PUT`` it back to Omeka.

Some servers do not accept ``PUT`` or ``DELETE`` requests. For compatibility
we've added support for the ``X-HTTP-Method-Override`` header, which you can use
Some servers do not accept ``PUT`` or ``DELETE`` requests. For compatibility
we've added support for the ``X-HTTP-Method-Override`` header, which you can use
to declare an unsupported HTTP method.

::
Expand Down
2 changes: 1 addition & 1 deletion source/Reference/libraries/Omeka/Test/Helper/Plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Package: :doc:`Test\\Helper </Reference/packages/Test/Helper/index>`
Lazy-loading for helper properties.

When a property is not set, attempts to load a default through standard
Omeka global state. If this state is unavailable or undesireable,
Omeka global state. If this state is unavailable or undesirable,
use the set*() methods before calling any of the other public methods of
this class.

Expand Down
2 changes: 1 addition & 1 deletion source/Tutorials/representativeFiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ functionality that depends on File records by choosing a "representative"
file. Omeka uses this functionality in the views for some records like
Collections and Files, and also in the search results page.

Themes and plugins can use a new helper funtion to display thumbnails for
Themes and plugins can use a new helper function to display thumbnails for
records with representative files, and plugins can also select and expose
representatives for their own records.

Expand Down
2 changes: 1 addition & 1 deletion source/Tutorials/understandingFilters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Filter Basics

Filters work similarly to hooks, but are focused on modifying data rather
than simply executing code or producing output in some particular place.
Filter functions always recieve two parameters.
Filter functions always receive two parameters.

The first parameter is always the value being filtered. The documentation
page for a filter will describe this parameter under the heading "Value."
Expand Down
14 changes: 7 additions & 7 deletions source/Tutorials/understandingFormElements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ The basic structure is to use the ``addElement()`` method, with three parameters

``string`` $element
A string name for the form element. Typical examples are: button, captcha, checkbox, file, multicheckbox, multiselect, radio, select, submit, text, textarea.

An element object can also be passed in here. In this (rare) case, the other two parameters are usually unnecessary

``string`` $name
The name attribute for the form element

``array`` $options
Additional options for the form element. ``label``, ``description``, and ``required`` are the most common options. HTML attributes such as ``rows`` and ``cols`` can also appear here, as well as ``class``
In more complex examples, an array of ``validators`` can also be passed here

In more complex examples, an array of ``validators`` can also be passed here

********
Examples
Expand All @@ -33,11 +33,11 @@ Examples
'description' => __('My record description'),
'rows' => 10
));
$form->addElement('text', 'user_email', array(
'label' => __('Email'),
'description' => __("Prefered email address of the person submitting the record"),
'validators' => array('EmailAddress'),
'description' => __("Preferred email address of the person submitting the record"),
'validators' => array('EmailAddress'),
'required' => true
));
Expand Down

0 comments on commit 18cf3f7

Please sign in to comment.