Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
Updated Docs. Tidied code
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Imrie committed Dec 8, 2011
1 parent 7b2f96c commit 0bfdc92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 48 deletions.
54 changes: 19 additions & 35 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -33,63 +33,39 @@ h2. Example Usage

h3. Simple Example

If you have setup a Matrix field called 'people' and within the Matrix settings you have created a moreMatrixRelations field called 'name', your templates may look like this:
If you have setup a Matrix field called 'people' and within the Matrix settings you have created a moreMatrixRelations field called 'name', your templates may look like this. The fieldtype:

<pre>
{exp:channel:entries channel="channel_name"}
<ul>
{people}
<li>{name}</li>
<ul>
{name}
<li>{title}</li>
{/name}
</ul>
{/people}
</ul>
{/exp:channel:entries}
</pre>

By default the field returns the entry title:
The output could be something like the following:

<pre>
<ul>
<li>John Smith</li>
<li>Richard Jones</li>
<li>Sarah Richards</li>
</ul>
</pre>

h3. Parameter Example

You can access different information regarding the related entry by using the 'field' parameter:

<pre>
{exp:channel:entries channel="channel_name"}
<ul>
{people}
<li>{name field="url_title"}</li>
{/people}
</ul>
{/exp:channel:entries}
</pre>

Produces:

<pre>
<ul>
<li>john-smith</li>
<li>richard-jones</li>
<li>sarah-richards</li>
<li>James Parker</li>
<li>Sarah Richards</li>
</ul>
</pre>

h2. Parameters

h3. _field_

Example:

<pre>
{field_name field="entry_id"}
</pre>
h2. Variables

Allows you to display different information about the related entry. Accepts the following field names:
The field type must always be used as a tag pair. The following top level channel entry variables are available inside the moreMatrixRelations tag pair:

* entry_id
* title - _[default]_
Expand All @@ -100,9 +76,17 @@ Allows you to display different information about the related entry. Accepts th
* status
* page_uri

Channel custom fields are not available.


h2. Change log

h4. 1.4

* Ability to select multiple entries from within the matrix field.
* Configuration option to restrict selection to a single entry or allow the multi select.
* Template tag updated to use tag pairs only.

h4. 1.3

* Ability to select entries from multiple channels. Entries are listed organised by channel when using the fieldtype in a Matrix field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Morematrixrelations_ft extends EE_Fieldtype {

var $info = array(
'name' => 'moreMatrixRelations',
'version' => '1.3'
'version' => '1.4'
);


Expand Down Expand Up @@ -156,32 +156,20 @@ function replace_tag($data, $params = array(), $tagdata = FALSE)
$vars = $q->result_array();



foreach($vars as $row){


//Add the pages URI
$row['page_uri'] = "";
foreach($data as $entry_id){
if(isset($this->EE->config->config['site_pages'][$this->EE->config->item('site_id')]['uris'][$entry_id])){
$row['page_uri'] = $this->EE->config->config['site_pages'][$this->EE->config->item('site_id')]['uris'][$entry_id];
}
}



//if(isset($params['field'])){
// return isset($qa->$params['field']) ? $qa->$params['field'] : NULL;
//}else{
// return $qa->title;
//}


}


return $this->EE->TMPL->parse_variables($tagdata, $vars);

}


Expand Down

0 comments on commit 0bfdc92

Please sign in to comment.