2017 © Pedro Peláez
 

library api

SamsonCMS API module

image

samsoncms/api

SamsonCMS API module

  • Monday, February 13, 2017
  • by samsonos
  • Repository
  • 3 Watchers
  • 0 Stars
  • 2,297 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

SamsonCMS API module

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Total Downloads Stories in Ready, (*1)

SamsonCMS API for interaction with materials, fields and structures., (*2)

Additional fields table

After creating corresponding Table structure and setting its Additional fields you can get additional fields table object(\samsoncms\api\field\Table) ancestor for a specific \samsoncms\api\Material ancestor you need to create class that extends generated additional fields table:, (*3)

class MyTable extends \samsoncms\api\MyGeneratedTable
{
    protected $indexView = 'specify a path to index view file';
    protected $rowView = 'specify a path to row view file';
}

// Creating an instance, with QueryInterface, ViewInterface and Entity identifier
$table = new MyTable($query, $this, $material->MaterialID)

This class will contain generated generic methods for retrieving collection of table column values with according field name, for example if you have additional field with name age method age() would be generated to get collection of age values in all table rows., (*4)

Rendering custom additional field tables

SamsonCMS will generate all created Table structure automatically to simplify your code creation, the only thing that needs to be done is extending this generated classes and creating a views for outputting., (*5)

Remember \samsoncms\api\field\Table is dependent on \samsonframework\core\ViewInterface instance and uses it for rendering its views, so the path to views and views themselves should be located within this instance., (*6)

Default index view file

By default index view renders all rendered rows into view variable with name stored in \samsoncms\api\field\Table::ROWS_VIEW_VAR - rows:, (*7)

<div class='my-table'>
    <h2>Table title<h2>
    <div class="my-table-rows">
        <?php echo $rows ?>
    </div>
</div>

Default row view file

By default \samsoncms\api\field\Row ancestor view object is stored in \samsoncms\api\field\Table::ROW_VIEW_VAR - row:, (*8)

<?php /** @var \myapplication\MyTableRow $row */?>
<div class="my-row">
    <div class="name"><?php echo $row->field1 ?></div>
    <div class="name"><?php echo $row->field2 ?></div>
    <div class="name"><?php echo $row->field3 ?></div>
</div>

Give a type hint to a generated \samsoncms\api\field\Row ancestor and IDE will help outputting needed row data., (*9)

Navigation

Material

Added method for creating/updating material additional fields public function setFieldByID($fieldID, $value, $locale = DEFAULT_LOCALE) Method find Field record in database by Field identifier and the receives its type for correct storing of additional field value., (*10)

Field

You can find additional field samsonframework\orm\RecordInterface object by using one of provided methods: * By its identifier \samsoncms\api\Field::byID($query, $identifier, &$return = null) * By its name \samsoncms\api\Field::byName($query, $name, &$return = null) * By its name or identifier \samsoncms\api\Field::byNameOrID($query, $identifier, &$return = null), (*11)

All this methods requires first argument samsonframework\orm\QueryInterface instance for performing database queries., (*12)

Regular usage example:, (*13)

/** @var \samsoncms\api\Field $fieldRecord Try to find additional field record */
$fieldRecord = \samsoncms\api\Field::byNameOrID('image')
if (isset($fieldRecord)) {
    // Additional field has been found
}

Last argument is optional and should be used for simple and beautiful condition creation:, (*14)

/** @var \samsoncms\api\Field $fieldRecord Try to find additional field record */
if (\samsoncms\api\Field::byNameOrID('image', $fieldRecord)) {
    // Additional field has been found
}

Field value

The Versions

13/02 2017

dev-0.0.8-fix

dev-0.0.8-fix http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

13/02 2017

0.0.10

0.0.10.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

28/01 2017

0.0.9

0.0.9.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

05/10 2016

dev-master

9999999-dev http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

05/10 2016

dev-8d5a214

dev-8d5a214 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

23/08 2016

0.0.8

0.0.8.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

23/08 2016

0.0.7

0.0.7.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

23/08 2016

0.0.6

0.0.6.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

23/08 2016

0.0.5

0.0.5.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

27/07 2016

0.0.4

0.0.4.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

27/07 2016

0.0.3

0.0.3.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

27/07 2016

0.0.2

0.0.2.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

15/07 2016

0.0.1

0.0.1.0 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

26/03 2016

dev-application-generator

dev-application-generator http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

23/03 2016

dev-new-generator

dev-new-generator http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko

11/02 2016

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1 http://samsonos.com/

SamsonCMS API module

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Nikita Kotenko