Overview

Namespaces

  • DcGeneral
    • Clipboard
    • Contao
      • Callback
      • Compatibility
      • DataDefinition
        • Definition
      • Dca
        • Builder
          • Legacy
        • Definition
        • Palette
        • Populator
      • Event
      • View
        • Contao2BackendView
          • Event
    • Controller
    • Data
    • DataDefinition
      • Builder
      • Definition
        • Properties
        • View
          • Panel
      • ModelRelationship
      • Palette
        • Builder
          • Event
        • Condition
          • Palette
          • Property
    • EnvironmentPopulator
    • Event
    • Exception
    • Factory
      • Event
    • Panel
    • View
      • Event

Classes

  • Command
  • CommandCollection
  • CutCommand
  • DefaultListingConfig
  • DefaultModelFormatterConfig
  • DefaultPanelLayout
  • DefaultPanelRow
  • DefaultPanelRowCollection

Interfaces

  • CommandCollectionInterface
  • CommandInterface
  • CutCommandInterface
  • ListingConfigInterface
  • ModelFormatterConfigInterface
  • PanelLayoutInterface
  • PanelRowCollectionInterface
  • PanelRowInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * PHP version 5
  4:  * @package    generalDriver
  5:  * @author     Christian Schiffler <c.schiffler@cyberspectrum.de>
  6:  * @author     Stefan Heimes <stefan_heimes@hotmail.com>
  7:  * @author     Tristan Lins <tristan.lins@bit3.de>
  8:  * @copyright  The MetaModels team.
  9:  * @license    LGPL.
 10:  * @filesource
 11:  */
 12: 
 13: namespace DcGeneral\DataDefinition\Definition\View;
 14: 
 15: use DcGeneral\Exception\DcGeneralInvalidArgumentException;
 16: 
 17: /**
 18:  * Default implementation for a panel row collection.
 19:  *
 20:  * @package DcGeneral\DataDefinition\Definition\View
 21:  */
 22: class DefaultPanelRowCollection implements PanelRowCollectionInterface
 23: {
 24:     /**
 25:      * The panel rows.
 26:      *
 27:      * @var PanelRowInterface[]
 28:      */
 29:     protected $rows = array();
 30: 
 31:     /**
 32:      * {@inheritDoc}
 33:      */
 34:     public function getRows()
 35:     {
 36:         $names = array();
 37:         foreach ($this as $row)
 38:         {
 39:             /** @var PanelRowInterface $row */
 40:             $names[] = $row->getElements();
 41:         }
 42: 
 43:         return $names;
 44:     }
 45: 
 46:     /**
 47:      * {@inheritDoc}
 48:      */
 49:     public function addRow($index = -1)
 50:     {
 51:         $row = new DefaultPanelRow();
 52: 
 53:         if (($index < 0) || ($this->getRowCount() <= $index))
 54:         {
 55:             $this->rows[] = $row;
 56:         }
 57:         else
 58:         {
 59:             array_splice($this->rows, $index, 0, array($row));
 60:         }
 61: 
 62:         return $row;
 63:     }
 64: 
 65:     /**
 66:      * {@inheritDoc}
 67:      */
 68:     public function deleteRow($index)
 69:     {
 70:         unset($this->rows[$index]);
 71:         $this->rows = array_values($this->rows);
 72: 
 73:         return $this;
 74:     }
 75: 
 76:     /**
 77:      * {@inheritDoc}
 78:      */
 79:     public function getRowCount()
 80:     {
 81:         return count($this->rows);
 82:     }
 83: 
 84:     /**
 85:      * {@inheritDoc}
 86:      *
 87:      * @throws DcGeneralInvalidArgumentException When the index does not exist.
 88:      */
 89:     public function getRow($index)
 90:     {
 91:         if (!isset($this->rows[$index]))
 92:         {
 93:             throw new DcGeneralInvalidArgumentException('Row ' . $index . ' does not exist.');
 94:         }
 95: 
 96:         return $this->rows[$index];
 97:     }
 98: 
 99:     /**
100:      * {@inheritDoc}
101:      */
102:     public function getIterator()
103:     {
104:         return new \ArrayIterator($this->rows);
105:     }
106: }
107: 
108: 
109: 
110: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0