texts: Store the values of a views exposed filter Form

texts:
I have build a form using the Form API that adds a checkbox to every row in my custom view (the view page can be found here: http://goo.gl/Pg6Ja7).
I want this form to store the values even after I change the exposed filter of the view or change the view page.

I was thinking to create a new submit button that will store the values on the current page, but I don't know how to do that, I googled the whole day. Or maybe some JavaScript ?

I added the View form with a handler, here is the simple code I wrote for it:

/**
   * @file
   *
   * A Views' field handler for adding a checkbox.
   *
   */
class files_download_links_mail_field_handler_checkbox  extends views_handler_field {
  function construct() {
    parent::construct();
    $this->additional_fields['nid'] = 'nid';
    //$this->additional_fields['field_file_download_link'] = 'field_file_download_link';

  }

  function query() {
    $this->ensure_my_table();
    $this->add_additional_fields();
  }

  function render($values) {
    // Render a Views form item placeholder.
    // This causes Views to wrap the View in a form.
    // Render a Views form item placeholder.
    return '<!--form-item-' . $this->options['id'] . '--' . $this->view->row_index . '-->';
  }

  function views_form(&$form, &$form_state) {
    // Create a container for our replacements
    $form[$this->options['id']] = array(
      '#type' => 'container',
      '#tree' => TRUE,
    );
    // Iterate over the result and add our new field to the form.
    foreach($this->view->result as $row_index => $row) {
      // Add a checkbox field to the form.
      $form[$this->options['id']][$row_index] = array(
        '#type' => 'checkbox',
      );
    }
  }

   /**
   * Form submit method.
   */
  function views_form_submit($form, &$form_state) {
    // Determine which nodes were selected.
    $selected_items = array();
    // Iterate over the view result.
    foreach($this->view->result as $row_index => $row) {
      if ($form_state['values'][$this->options['id']][$row_index] == 1) {
        $selected_items[$row->{$this->aliases['nid']}] = $form_state['values'][$this->options['id']][$row_index];
      }
    }
    // Grab the nodes
    $nodes = node_load_multiple(array_keys($selected_items));
    dpm($nodes);
  }
}
?>

Thanks!


texts:
I am trying to create a form with essentially form elements stored inside a table. After digging around,  have two alternatives:

1) Install Webform module along with the Webform Table Element module. Now both modules have been enabled and have cleared the caches for the heck of it. I can make the Webform alright, but I don't know how to make use of the Webform table element module and make the webform contents appear within a table. So I am not sure how to go about doing this

2) (SIDE QUESTION):  The other alternative is to create a custom module that would let me build my own form with tables and all that jazz. But I am keen on learning the Drupal way although I always prefer hand-coding my challenges.


texts:
I'm using Services Views to create a JSON output of my Drupal site's nodes. These nodes has a start and stop date and time regarding an event. On the site, viewing the node, the time is correct, but in my Services view it is shown in UTC instead of my Drupal site's timezone (UTC +2).

I've seen other questions regarding this issue with a DB and site timezone being different, with all the issues it creates - especially in cases just like this.
Eg.:
http://dropbucket.org/node/559 and
Drupal timezone and database and Printing the correct date value in a view

In this case, however, I do have a problem converting the value into the correct timezone and therefore the correct time.

I have the site set to UTC +2 (Sweden/Stockholm), users arn't allowed to have any other timezones, also the date field is set to save the date in the site's timezone, not the DB.

My view wont let me rewrite my output so I can't convert the date inside the view - nor would I like to run PHP in a view anyway.

Is there another way of converting, or at least changing the setting for the date save, so that this won't be a problem?

Cheers,
Daniel


texts: Hide node and file paths in view when printing page

texts: I have a views page that lists nodes that contain uploaded PDF and bibtex files (see here). Everything looks fine when you view the page, but when you go to print it in the browser, the node path (from the linked title) and the path to the uploaded files are displayed.  The client would like to be able to print the page without  those paths being shown.  Is there a way to suppress these paths when printing from the browser? I suggested having a link to another print friendly page, but he just wants to be able to print from the browser.


texts: Adjust viewability of content based on the value of a field for a specific user

texts:
For my website, I have a view (created using the Views module), let's call it View1, that displays content types that have field of user entity references (as in, it's a select list with all the users for the website on there).

I have a separate view (Views module), let's call it View2, that is used by non-admin users. I would like that view to be populated by content types that have been assigned to them by the admin. The admin uses the select list mentioned above to assign users to a certain user.

Is there a way to filter content types in View2 so that it only displays content that has been assigned to you from View1?


texts: unable to edit content created by user 1

texts: In drupal 6 I have created an admin user with the permissions to add, edit and delte all kind of nodes. The problem is that I am unable to edit nodes through this newly created admin user which are created by user1. any idea ??


texts:
A follow up to this thread: Can't install experimental modules

I've installed Drupal 8.2.5 two times on my server. First with the "minimal installation" option, and after that with the "normal installation" option. In both cases the installation worked without any errors. But in both cases I can't install experimental modules. I set the check mark next to an experimental module, then click install, the site refreshes and nothing changes. I can install other modules just fine. Since I must upgrade an existing Drupal 7 installation, I need the experimental Migrate modules.

No error messages are given, neither in "reports" nor on server level. Does someone know why this pre-alpha-like error occurs and how to avoid it?


texts: Optionally bypass required fields for content type

texts:
I'm sorry that I don't have more to share, as far as code goes, but I keep hitting dead ends and am not sure how I should be going about this. I keep trying very D7 methods, but I think that's not only bad for D8, but possibly not possible.

What I want is this:
- I'm looking for a submit button (but not THE submit, something more like "draft") to be able to save a node, but also ignore all required fields (except for title of course, 'cause that's absolutely necessary.)
- This is for something like a draft, where it only needs to make sure all required fields are entered when finally submitting

Can anyone give general guidance on how I might be able to do this? I keep thinking of trying to add a validation function/override the form's validation function, but that seems to be hitting a dead end for me and also seems like it may be too D7.


texts:
I have a field that can accept unlimited values. I want to print those values in my template.

The array that I can see with the devel module looks like this....

Array
(
    [und] => Array
        (
            [0] => Array
                (
                    [value] => Dustin
                    [format] =>
                    [safe_value] => Dustin
                )

            [1] => Array
                (
                    [value] => Jen
                    [format] =>
                    [safe_value] => Jen
                )

            [2] => Array
                (
                    [value] => Mike
                    [format] =>
                    [safe_value] => Mike
                )

        )

)

What I'd like to do is have these values printed to a comma separated list like: Dustin, Jen, Mike

I've been using this code to print single value fields in my template but that of course isn't going to work well with a multi value field..

<?php echo $entityform->field_team_name['und'][0]['value']; ?>


texts: Module for managing permissions on per node basis integrated with shopping cart or checkout

texts:
Hey I'm looking for a way to manage specific users access to specific nodes in Drupal. I'm wondering which modules I can use to accomplish this.

To elaborate:

Lets just say I have 20 stories on my site that cost 5$ each to access. Users need to sign up, and then they pay $5 for each story they want to have access to.

I need to manage the individual user's access to specific nodes automatically after they are paid for...

Anything you can point me toward would be helpful

Thanks


texts:
I use theme information to style the output of my view.
I'm overriding this file: @file views-view-fields.tpl.php

I access my custom fields by using:

$fields['field_FIELD_NAME']->content

Now I want to get the link to the node.
I know I can get the link by choosing "link field to node" in the view settings.
However, I don't want each field to link individually, I want to wrap them in a link.
Any ideas ?
Thanks!!


texts: How to extend a specific node type form?

texts:
I am searching a way to overwrite the NodeForm to get a class per bundle.

Actually EntityForm manages the form for all entities.
NodeForm extends it and manages the forms for all nodes.

I wrote a CustomNodeForm replacing NodeForm behaviour for all nodes.

/**
 * Implements hook_entity_type_build().
 */
function ftvisi_main_entity_type_build(array &$entity_types) {
  $entity_types['node']->setFormClass('default', CustomNodeForm::class);
}

Now I'd like to get a class per bundle extending that CustomNodeForm but I feel like I am not able to do it.

CustomNodeForm might instantiate a form for each bundle - but I don't like that approach and we still just have one constructor which can leads to problems such as:

"OK my first bundle form needs this service, and my second bundle form needs another one, should I inject the full container itself and then use services on the fly ?" => Pretty bad idea, I know.

Anyway, if CustomNodeForm instantiates other classes itself, it will be hard to mock and test. So I definitively don't like that approach.

I then thought about using the form modes, but same problem: a form mode can be used on any node type, so we still don't have a class per bundle and we still have only one constructor for all forms using that form mode.

Any idea to help?


texts: How to redirect user when new node save by ajax in advance form block drupal 7?

texts:
I have a website in drupal 7. I used advanced form block module to create add form block. Advanced form block module create block for form to edit and add new content. All node saved by ajax submission.

I want to redirect the user when new node save by this form. I used rules and form[#redirect] method in my hooks, but these are not working.

Can any one help me to figure out this?

Thanks


texts: How to add UniqueField constraint on integer field?

texts:
The title basically says it all. I have the following field definition in an Entity class:

$fields['code'] = BaseFieldDefinition::create('integer')
        ->setLabel(t('unique code'))
        ->setDescription(t('Some unique code'))
        ->addConstraint('UniqueField')
        ->setTranslatable(false)
        ->setRequired(true)
        ->setDisplayOptions('view', array(
            'label' => 'above',
            'weight' => 4,
        ))
        ->setDisplayOptions('form', array(
            'weight' => 4,
        ))
        ->setDisplayConfigurable('form', true)
        ->setDisplayConfigurable('view', true);

Creating a new entity in the UI works as expected as long as I do not set the code value to something already in the database. However, as soon as I try to create a new entity with an already existing value for code (thus triggering a constraint violation), I get the following error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\Core\Form\FormState::setError() must be of the type array, null given, called in /var/www/html/web/core/lib/Drupal/Core/Field/WidgetBase.php on line 454 in Drupal\Core\Form\FormState->setError() (line 1156 of core/lib/Drupal/Core/Form/FormState.php).

If I change the field definition to use a string instead everything works as expected:

$fields['code'] = BaseFieldDefinition::create('string')
        ->setLabel(t('unique code'))
        ->setDescription(t('Some unique code'))
        ->setSetting('max_length', 5)
        ->addConstraint('UniqueField')
        ->setTranslatable(false)
        ->setRequired(true)
        ->setDisplayOptions('view', array(
            'label' => 'above',
            'weight' => 4,
        ))
        ->setDisplayOptions('form', array(
            'weight' => 4,
        ))
        ->setDisplayConfigurable('form', true)
        ->setDisplayConfigurable('view', true);

So the question is how do I add a unique constraint for an integer field? Is there another validation class I can use, am I setting up my integer field definition wrong thus causing the error, or?


texts: Drush misidentifies my D7 site as drupal 8

texts:
I'm using Drush Commandline Tool 9.2.1 in a Drupal 7 webroot and I'm unable to run it.
$ drush -vvv cc all
 [preflight] Config paths: /home/user/.composer/vendor/drush/drush/drush.yml
 [preflight] Alias paths:
 [preflight] Commandfile search paths:
             /home/user/.composer/vendor/drush/drush/src
 [bootstrap] Bootstrap to max [0.14 sec, 11.2 MB]
 [debug] Trying to bootstrap as far as we can [0.14 sec, 11.21 MB]
 [error]  `cache-clear all` is deprecated for Drupal 8 and later.
          Please use the `cache-rebuild` command instead.

Seems to suggest that it thinks the site is D8 but it's a D7 site.
$ drush list
(...commands listed as normal...)
! [NOTE] Drupal root not found. Pass --root or a @siteAlias in order to
see Drupal-specific commands.

Says it can't identify the root. I'm in it! And my settings file is fine at the normal location of sites/default/settings.php
Even passing --root and -l options does not help - I still get the same errors.
Never had this before. Any ideas?
EDIT
Here's why I didn't think this was a silly question:

Source: http://docs.drush.org/en/7.x/install/ at 23 Mar 2018.


texts: How can I restrict libraries to attach to my custom controller only?

texts:
I have a custom module that creates its own page and displays some stuff. I have some CSS and JS to add, and I'm using a library. The CSS and JS are being added, but to every page on the site. Can someone tell me how to restrict them to this page only?

The docs say "But what matters most is that we don't decide whether to attach a library based on which page we're on (i.e. which URL or route), but based on which things are visible on the page..." So, if that really is what matters most, then maybe I'm going about this all wrong?

MycontrollerController.php

<?php

namespace Drupal\mycontroller\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Returns responses for mycontroller routes.
 */
class MycontrollerController extends ControllerBase {
  public function content() {
    return [
      '#title' => 'My Controller',
      '#plain_text' => 'Here is some text.'
    ];
  }
}

mycontroller.info.yml

name: My Controller
description: It's a very nice controller
type: module
core: 8.x

mycontroller.routing.yml

mycontroller:
  path: '/mycontroller'
  defaults:
    _title: 'Mycontroller'
    _controller: '\Drupal\mycontroller\Controller\MycontrollerController::content'
  requirements:
    _permission: 'access content'

mycontroller.libraries.yml

mylibrary:
  version: 1.x
  css:
    layout:
      css/mycontroller-layout.css: {}
  js:
    js/mycontroller.js: {}

mycontroller.module

<?php
function mycontroller_page_attachments(array &$attachments) {
  $attachments['#attached']['library'][] = 'mycontroller/mylibrary';
}

My directory structure...

mycontroller
|-- css
|   `-- mycontroller-layout.css
|
|-- js
|   `-- mycontroller.js
|
|-- mycontroller.info.yml
|-- mycontroller.libraries.yml
|-- mycontroller.module
|-- mycontroller.routing.yml
`-- src
    `-- Controller
        `-- MycontrollerController.php


texts: "View unpublished content" permission for non-author

texts:
I googled a bit to see if there's a permission-level way to allow a logged-in (but non-admin) user see unpublished content (marked with the CSS node-unpublished class). This appears to be scheduled for Drupal 8 only. But maybe someone was clever enough to do a workaround?

I have a role named Content Editor which should be able to see all unpublished content, regardless of whether they were the author or not.


texts:
I created a custom module named my_module.

In hook_menu() I define the following path.

$items['my-module/item'] = array(
  'title' => 'Item',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('my_module_item_form'),
  'access arguments' => array('access item content'),
);

This is the code for my_module_item_form().

$arg = arg(1); // Problem here! Should return "item", right?
...
// $form[...] = array('#ajax' => ...);

$form['arg'] = array(
  '#type' => 'hidden',
  '#value' => $arg,
  // I also tried '#default_value'
)

// Submit field

Basically, I really need to obtain item in arg(1) and nothing else.

When I edit fields (not fields with ajax) and click submit, I can obtain the correct arg(1) in my hook_submit which is "item". Now, when I edit fields with ajax and click submit, arg(1) returns "ajax" which I do not like.

How should I obtain "item" in arg(1) in in the form submission handler during an ajax call in my form?


texts: Insert JavaScripts into head of only one page

texts:
I want to an SVGMap product that requires that I insert the following javascript into head but I only want to use this on one page of my website in a block. If I insert it into the html.tpl.php page, it will load for every page. Is this a drain on resources or is there a better way to do it for just the block that I need it?

Thanks

<link href="/mapsvg/css/mapsvg.css" rel="stylesheet">
<script src="/mapsvg/js/jquery.js"></script>
<script src="/mapsvg/js/jquery.mousewheel.min.js"></script>
<script src="/mapsvg/js/mapsvg.min.js"></script>


texts: How can I programmatically override the title tag from within custom module?

texts: I have a custom module that creates a search form and displays search results. We have a need where we want the title that displays in the browser tab to change depending on the search criteria. This particular search searches jobs that are available in specific specialties. I know you can use drupal_set_title() to change the title that gets displayed to the user in the H1 tag on the page, but what I am talking about is changing the title in the browser. The actual title tag for SEO purposes. So by default, the Browser tab title says "Job Search | My Site Here" ("My Site Here" is a place holder for the actual name of my site). When they perform a search we want the title to change to "{Specialty Name} Jobs | My Site Here". So for example if they search on the specialty "Cardiology", the browser title will be "Cardiology Jobs | My Site Here". I know there are custom modules to handle changing the page title dynamically, but those are for existing content types. This job search has been created completely from within a custom module, so ALL of the pages are dynamic. Is there a way to edit the browser page title independently of the drupal_set_title() function from within the custom module?


texts:
Can anybody suggest to me how I can write a dynamic query in Drupal for the below MySQL query.
Any suggestion will be appreciated.

select * from cap_pas where pas_uid not in
  (select pas_uid from cap_boat_to_pas)


texts: Value of the input is not preserved when it is an HTML array

texts:
Suppose, we have a form, containing 3 elements:

Checkbox with special name 'name[attached]', indicating that it is a part of an array of checkboxes.
Text input
Submit button

Code

function bundles_test_form($form, &$form_state)
{
    $form['name[attached]'] = array(
        '#type' => 'checkbox',
        '#required' => false,
        '#attributes' => array('name' => 'name[attached]'),
        );

    $form['date'] = array(
        '#type' => 'textfield',
        '#required' => false,
        );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
        );

    return $form;
}

function bundles_test_form_validate($form, &$form_state)
{
    if (isset($form_state['input']['name']['attached']))
    {
        if ($form_state['input']['date'] === '')
        {
            form_set_error("date", 'date is required');
        }
    }
}

Question

When the form throws an error, the checkbox must be checked, but it is not. When I change the name to "name" or anything that it not the array, it works correctly. So the error is caused by the non-standard name of the input.


texts: Module similar to module filter to filter content and users?

texts: I use Module filter module to filter the long list of modules. It comes very handy to find a module rather than using CTRL+F always. I was wondering if there is a module which can filter the content (at admin/content) and/or users (at admin/people) as well.


texts: How to display a block for some paths but not if they match some other path also?

texts:
Let's say I have nodes with the following paths:

/chapters/university-of-florida/classrooms/class1
/chapters/university-of-chicago/classrooms/class2
/chapters/ucla/classrooms/cla

I'd like to display a custom block I created on these URLs, but I don't want it to show on:

/chapters/university-of-florida/
/chapters/university-of-chicago/
/chapters/ucla/

Any ideas how to accomplish this? Note that there will be new chapters and classrooms being added all the time, so I don't want to have to manually specify the paths.

I think the Context module could work here, but I am not sure how to specify the exclusions...

Any tips?


texts:
I have a Content Type with a field that references 6 different paragraph types.  The field is set up to accept unlimited values.   For one of the types I would like to have exactly four values added.  I've been trying to add a Constraint but it seems that Constraints are built to check if a fields values are valid and not if there are only four items

Is using hook_entity_bundle_field_info_alter the correct hook or should I be focused on using hook_entity_type_alter or maybe even some other method?


texts: Difficulty running tests, --group option not being respected

texts:
I am trying to run a BrowserTestBase based test in my own module, following the documentation on drupal.org.

No matter if I run the test from PHPStorm or command line, I get the same error:

vagrant@local:/var/www/mysite/docroot$ ../vendor/bin/phpunit -c core/phpunit.xml --group mymodule
PHP Fatal error:  Trait 'Drupal\Tests\facets\Functional\BlockTestTrait' not found in /var/www/mysite/docroot/modules/contrib/search_api_solr/tests/src/Functional/FacetsTest.php on line 20
PHP Stack trace:
PHP   1. {main}() /var/www/mysite/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /var/www/mysite/vendor/phpunit/phpunit/phpunit:52
PHP   3. PHPUnit_TextUI_Command->run() /var/www/mysite/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP   4. PHPUnit_TextUI_Command->handleArguments() /var/www/mysite/vendor/phpunit/phpunit/src/TextUI/Command.php:111
PHP   5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /var/www/mysite/vendor/phpunit/phpunit/src/TextUI/Command.php:649
PHP   6. PHPUnit_Util_Configuration->getTestSuite() /var/www/mysite/vendor/phpunit/phpunit/src/Util/Configuration.php:878
PHP   7. PHPUnit_Framework_TestSuite->addTestFile() /var/www/mysite/vendor/phpunit/phpunit/src/Util/Configuration.php:1000
PHP   8. ReflectionMethod->invoke() /var/www/mysite/vendor/phpunit/phpunit/src/Framework/TestSuite.php:353
PHP   9. Drupal\Tests\TestSuites\FunctionalTestSuite::suite() /var/www/mysite/vendor/phpunit/phpunit/src/Framework/TestSuite.php:353
PHP  10. Drupal\Tests\TestSuites\TestSuiteBase->addTestsBySuiteNamespace() /var/www/mysite/docroot/core/tests/TestSuites/FunctionalTestSuite.php:22
PHP  11. PHPUnit_Framework_TestSuite->addTestFiles() /var/www/mysite/docroot/core/tests/TestSuites/TestSuiteBase.php:55
PHP  12. PHPUnit_Framework_TestSuite->addTestFile() /var/www/mysite/vendor/phpunit/phpunit/src/Framework/TestSuite.php:384
PHP  13. PHPUnit_Util_Fileloader::checkAndLoad() /var/www/mysite/vendor/phpunit/phpunit/src/Framework/TestSuite.php:310
PHP  14. PHPUnit_Util_Fileloader::load() /var/www/mysite/vendor/phpunit/phpunit/src/Util/Fileloader.php:38
PHP  15. include_once() /var/www/mysite/vendor/phpunit/phpunit/src/Util/Fileloader.php:56

Fatal error: Trait 'Drupal\Tests\facets\Functional\BlockTestTrait' not found in /var/www/mysite/docroot/modules/contrib/search_api_solr/tests/src/Functional/FacetsTest.php on line 20

I am not requiring Search API Solr in my test, nor do I have a clue why it is running it. Even if I specify --testsuite unit, I get the same error.

Here is the test I am trying to run, with a basic test step:

namespace Drupal\Tests\mymodule\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Class AuthenticationTest.
 *
 * @group mymodule
 */
class AuthenticationTest extends BrowserTestBase {

  /**
   * Required modules.
   *
   * @var array
   */
  protected static $modules = ['user', 'node'];

  public function setUp() {
    parent::setUp();

    // set config for netforum
  }

  /**
   * The superuser should not authenticate to Netforum.
   */
  public function testAdminUserUsesDrupalAuthentication() {
    $account = $this->drupalCreateUser(['administer site configuration']);
    $this->drupalLogin($account);
  }

}

I am not sure why it is even looking at the Search API Solr module, but the test in question does try to use several files that do not exist:

use Drupal\Tests\facets\Functional\BlockTestTrait;
use Drupal\Tests\facets\Functional\ExampleContentTrait;
use Drupal\Tests\facets\Functional\TestHelperTrait;

I assume these are a part of the Facets module, which I do not have.

edit: This might be my issue.


texts: How to use two different image styles on teaser?

texts:
I want to use Medium image preset on teaser when the article is featured, then change to thumbnail style after. Is it clear? For example, in a cuisine recipes website I want to show a "Recipe of the Day" with a medium style image and tomorrow that recipe will be change by the newest ("Recipe of the Day") and shown with thumbnail style. Is it possible?

Thanks in advance.

Alex


texts: How to award User Points after checkout using Rules?

texts:
I'm trying to award some User Points to users who select a certain plan during his checkout process.

Here is the explanation of my website functionality.

When a user register with a role, the user will get access to the website with certain functionality.
Some users will be having permission to create new nodes.
During the node creation, the user needs to select a plan (I'm using Commerce Node Checkout module to add product as plan).
Based on the user's selection, the user will be redirected to the checkout page.
After completion of the checkout process, the user will receive some User Points. For this I have created a rule, but it is not working as expected.

Here is the export of my rule:

{ "rules_per_day" : {
    "LABEL" : "Per day",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "per day" ],
    "REQUIRES" : [ "commerce_order", "userpoints_rules", "commerce_checkout" ],
    "ON" : { "commerce_checkout_complete" : [] },
    "IF" : [
      { "commerce_order_contains_product" : {
          "commerce_order" : [ "site:current-cart-order" ],
          "product_id" : "day_4dxivfX2oFRAqQH-Ij6VBFnBheZBRIo744cF46KKPSI",
          "operator" : "=",
          "value" : "1"
        }
      }
    ],
    "DO" : [
      { "userpoints_action_grant_points" : {
          "user" : [ "site:current-user" ],
          "points" : "50",
          "tid" : "0",
          "entity" : [ "commerce-order" ],
          "description" : "You have received  the points for selected plan.",
          "operation" : "Insert",
          "display" : 1,
          "moderate" : "approved"
        }
      }
    ]
  }
}

The Rules Condition checks whether the order contains a specific product withe the product id n.

I don't understand what I did wrong or what I have missed in this rule. Any suggestions to make this rule work?


texts:
I tried to convert a text field filter for title into a select list filtered by content type using hook form alter:

function myhook_form_alter(&$form, &$form_state, $form_id) {

  if($form_id == 'views_exposed_form'){

      // load nodes filtered by content type - news
      $nodes = node_load_multiple(array(), array('type' => 'news'));

      // Build an array
      $dropdown_array = array('' => '--Any--');
      foreach ($nodes as $node) {
         $key = $node->title;
         $value = $node->title;

         $dropdown_array[$key] = $value;
      }

      // Alter form
      $form['title'] = array(
         '#type' => 'select',
         '#default_value' => '1',
         '#options' => $dropdown_array,
      );

   }//endif

}

The code above works well. Now I wonder is there a better, shorter, more efficient or proper API to implement ? I'm a newbie in drupal programming. Learning to code in a more drupal way. Please advise. Thanks.


texts:
I'm currently using the Elasticsearch Connector to get my data from Elasticsearch for displaying. I've managed to set up some basic pages and display the data successfully, but am now looking for a way to group it.
for example, if I have several results but they are all from the same server address, I would like to group them by server and show only the lastest input.

I've looked through options on views, and the aggregator module but can't seem to manage it.
Is this something that's possible, and I've missed?
Or is that not possible in drupal anyway?


texts: Access to preprocess variables in a custom block

texts:
I have created a custom block to display some contact information.

I have a preprocess function that sets a contact variable like so:

function atstump_preprocess(&$vars, $hook) {
    $vars['contact'] = array(
        'name' => 'Doug Gillum',
        'business' => 'Portland Stump Grinding',
        /...
    );
}

I enabled the PHP filter, and set this as the text:

<?php print $contact['name']; ?>

<?php print $contact['phone']; ?>

<?php print $contact['email']; ?>

However it doesn't recognize $contact as a proper variable and generates the PHP error E_NOTICE:

Notice: Undefined variable: contact in eval() (line 2 of C:\xampp\htdocs\stumpgrinding\modules\php\php.module(75) : eval()'d code).
Notice: Undefined variable: contact in eval() (line 3 of C:\xampp\htdocs\stumpgrinding\modules\php\php.module(75) : eval()'d code).
Notice: Undefined variable: contact in eval() (line 4 of C:\xampp\htdocs\stumpgrinding\modules\php\php.module(75) : eval()'d code).

Is it even possible to access the preprocess variables in a PHP filter? if not, is there a better way than hard coding them? maybe variable_set and variable_get and how would I set that up via the theme, I'd rather not make a module for this.


texts: How to show different Views for the same URL with contextual filters

texts:
I have 1 View with contextual filter: /catalog/%
% - is taxonomy term and it can be several terms (I use them for Porducts groups) like: Phones, Accesoiries, Tablets, etc.
So, when Views get URL with Phones argument it show all its stuff on /catalog/phones page.

Problem is, that I also want to have another Views for Tablets, which should have the same address with contextual filters: /catalog/%. It should show Tablets staff after getting Tablets as arguments.

I can not use only 1 Views for both product categories, because Phones and tablets will have different set of fields to show.

Right now only 1 Views is shown. Second is empty.
How to fix it?


texts: How to disable automatically generated comments in node, but enable programmatically created comments?

texts: I decided to programatically print comments un Views using PHP footer. The problem is that they now appears twice (my code + default). When I disable comments in content type settings, both disappear. How can I disable the default comments and keep my comments printed by php code? I tried to edit node.tpl file. but there is no section responsible for showing comments there (I use Garland).I do this because I am using a complicated views structure and I would like the comments to be displayed below the node, but not at the end of the whole view. Any advice appreciated.


texts: Organic Groups email group members permission denied

texts:
I have a fresh D7 installation with the latest OG modules and a few groups, users, and group articles added. However, I'm getting "Access Denied" when I click "Email People" in the group page. OG Email Blast is enabled and this problem happens regardless of setting the admin user as group manager and administrator member of the group. The problem happens for all users.

Any help would be greatly appreciated.


texts: Why does boost turn off standard caching?

texts:
When you enable the Boost module, it disables the standard Drupal caching (as at http://drupalperformanceblog.com/drupal-performance-tips), but it only reports boost as being incompatible with "aggressive" caching, and allows you to turn it back to "normal."
Does boost turn this off because it's unnecessary, or because it's actively harmful? Or does it not matter anyway?

(See also Is it redundant to use the "boost" module if varnish is used? with reference to using multiple caching systems.)


texts: Most popular content content modules in Drupal 7?

texts:
What's the best way to do most popular content in Drupal 7?

I've been using the Most Popular module because I haven't been able to find anything else, but that only has ~750 odd users spread between the D6 and D7 versions. Surely popular content is a fairly-common requirement? That leads me to believe there's a better maintained (and hopefully less buggy) module that does the exact same thing, just it has an obscure name and I can't find it via Google. If so, what is it?

(If you're going to crucify me for asking for an alternative module, note that I've contributed several issues and a documentation patch for Most Popular, and have volunteered to contribute code patches. However, there hasn't been a single commit on that module in ~6 months.)

Thank you!


texts: comma separated cck multivalues in a view

texts:
I've created a cck field and called it authors so the machine name is field_authors. To print this field in a view template, i'm doing this - print $fields['field_authors_value']->content;
In case is there 2 or 3 values it prints each value on separate line, and i want something like author1, author2, author3. (comma separated)

Tried to do this way in template.php:

function mytheme_content_view_multiple_field($items, $field, $values) {
  $output = '';
  switch($field['field_name']) {
    case 'field_authors_value':
      $output .= '
'. implode(', ', $items) .'
';
      break;

    default:
      foreach ($items as $item) {
        if (!empty($item) || $item == '0') {
      $output .= '
'. $item .'
';
    }
      }
      break;
  }
  return $output;
}

but it has no effect. What im doing wrong?


texts: How to limit notifications on an node edition to some specific nodes?

texts:
I'm using the Notifications module Notifications 7.x-1.0-alpha2 on Drupal 7

I'd like to have notifications allowed only on some specific nodes (for examples, node/1 and node/3).
The module has a "content type" notification, which sends mails each times a change is made on any node of that content type.

But I'd like to have those notifications only on some specific nodes(for examples, node/1 and node/3), and I can't find out how to do that with the Notifications module.

As I'm already using that module on our Forum, it would be best not to have to use another module, also.

Any suggestions?


texts:
From VueJS, I am sending a POST HTTP request to my Drupal 8 controller.

Here is my Controller:

<?php

namespace Drupal\mymodule\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Request;

class ExampleController extends ControllerBase {

  public function doSomething( Request $request) {

    \Drupal::logger('mymodule')->notice($request->getContent());
    \Drupal::logger('mymodule')->notice($request->request->get('message'));

    return [];
  }
}

The first log entry outputs:

@"params":{"message":"hello world","headers":@"Content-Type":"application/json; charset=UTF-8","Access-Control-Allow-Origin":"http://localhost:8080"}

The second log entry fails (it is empty).

What am I doing wrong and how am I supposed to retrieve this message POST parameter?

For completeness, here is the JS POST request:

this.$http.post('http://mydrupal8.url/simple_path', {
  params: {
    'message': 'hello world'
  },
  headers: {
    'Content-Type': 'application/json; charset=UTF-8',
    'Access-Control-Allow-Origin': 'http://localhost:8080',
  }
}).then(response => {
  // response
}, response => {
  // error callback
});

mymodule.routing.yml file:

mymodule.api_example:
  path: 'simple_path'
  defaults:
    _controller: '\Drupal\mymodule\Controller\ExampleController::doSomething'
  methods: [POST]
  requirements:
    _access: 'TRUE'


texts:
I'd like to get the following jQuery code to run on any forms on my site:

(function($) {
  // Hide any N/A radio buttons
  $('.form-radio[value=_none]').parent().hide();

  // Uncheck a radio button on double-click
  $('.form-radio').dblclick(function(){
    $(this).prop('checked', false);
  });
})(jQuery);

I've read that I can probably just add it to my template.php file, but I'd like to put it in a module. How would I do that?

UPDATE:

Thanks for the suggestions! So I went with option 3 because it seemed to make the most sense to me for my use-case. I still wasn't getting my jQuery to actually work though. I've updated it to this now:

(function($){
  Drupal.behaviors.doubleClickNA = {
    attach: function (context) {
      // Hide the N/A radio button
      $('.form-radio[value=_none]').parent().hide();

      // Enable the double-click unchecker function
      $('.form-radio').dblclick(function(){
        $(this).prop('checked', false);
        $(this).parent().parent().$('.form-radio[value=_none]').prop('checked', true);
      });
    }
  };
})(jQuery);

That seems to get the N/A radio button to disappear, but the second function still doesn't work. The $('document').ready part was the key for the first function (duh, right?), but I believe I need to use a behavior to get the double click action to work after the page as finished rendering. What more am I missing here?


texts: How to notify users from within a module

texts:
I'm building a custom module for a project and would like to display a notification/warning to the user once something happens. For instance, my module would trigger a Mailchimp action. Once I get the Ok from Mailchimp, I'd like to show a message to user, something like using Devel's dvm or dpm function.

How can I accomplish this (preferably without additional modules)?

Thanks in advance.

PS: I could use Devel, but I'd rather disable it in production env.


texts: Routing custom module with alphabetic pagination

texts:
My custom module:
- Plugin/Ziektes.php array returns to hook_theme

public function build() {

$letter_path = 'B';
$path = base_path();
$current_url = Url::fromRoute('<current>');
$current_path = $current_url->toString();

// Query for newest articles and return max 3 results.
$query = \Drupal::entityQuery('node');
$news = $query->condition('type', 'ziekte')
  ->condition('status', 1)
  ->condition('title', $letter_path, 'STARTS_WITH' )
  ->sort('created', 'ASC')
  ->execute();

// LoadMultiple News in $nodes variable
$nodes = Node::loadMultiple($news);

// Return $nodes variable with name items to the module.
return array(
  '#theme' => 'mytheme_ziektes',
  '#items' => $nodes,
  '#path'  => $path,
  '#url'   => $current_path,
);

I have an alphabetical pagination printedn in twig like this:

Below this pagination there are the results of nodes for example in the letter 'B' there are nodes from content-type 'ziektes' that starts with the letter B.

As you can see in my module Ziektes.php file its not dynamic it uses

$letter_path = 'B';
->condition('title', $letter_path, 'STARTS_WITH' ).

When there is clicked on a letter it goes to ziektes/'theletter' for example ziektes/b so that I can get the letter from the url and make the query dynamic.

But at page ziekte/*anyletter I get an 404 page not found so I've made a Controller and a routing:

Routing:

myroutingname.settings:
  path: '/ziektes/{letter}'
  defaults:
    _controller: '\Drupal\myblocksroute\Controller\ZiektesController::ziekte'
    _title: 'Routing Ziektes'
  requirements:
    _permission: 'access my routing ziektes'

Controller:

namespace Drupal\myblocksroute\Controller;

class ZiektesController
{
  public function ziekte($letter) {
    return [
      '#title' => $letter
    ];
  }
}

This returns the letter that is clicked, that's good! But Its only a new page with the as title the letter 'b' for example, I can't keep the twig template and the EntityQuery are not reachable from here. It suppose to stay at /ziektes form template but the url is /ziektes/b, so that the query will check the letter after the ziektes/ where I can make my $letter_path dynamic.

How can I do this?


texts:
How can I tell which entity is throwing this error (on all pages)?

  TypeError: Argument 4 passed to Drupal\views\Plugin\views\display\Block::__construct() must implement interface Drupal\Core\Entity\EntityManagerInterface, instance of Drupal\Core\Entity\EntityTypeManager given, called in /usr/local/var/www/hifldlive/web/modules/contrib/ctools/modules/ctools_views/src/Plugin/Display/Block.php on line 54 in Drupal\views\Plugin\views\display\Block->__construct() (line 69 of core/modules/views/src/Plugin/views/display/Block.php).

I have run composer update on an un-familiar site.
Composer update, drush updb and drush cr all run without errors.
There are about 20 migration tables generated.

I'm guessing I need to roll back the composer update (since it trashes the site), fix the data, then re-run the composer update.
I stuck on how to identify what to fix.
It is no problem to roll back.

I can't where entities are stored in the database.
I also don't see entities in the admin pages.

I can use Drupal Entity API in a custom module, but the site won't load on any page.


texts: Which variables do I need to export with Strongarm?

texts:
I have a theme based on adaptivetheme, which uses the color selector tool to allow one to edit the theme's color scheme through the UI.

When exporting a feature using the theme, the following variables are available:

color_themename_files
color_themename_logo
color_themename_palette (gives the list of colors)
color_themename_stylesheets

If exporting color_themename_files, an array of files like the following is exported:

array(
  0 => 'public://color/omtheme-58e01b40/bullet-round.png',
  1 => 'public://color/omtheme-58e01b40/bullet-sm-arrow-right.png',
  2 => 'public://color/omtheme-58e01b40/bullet-sm-arrow-down.png',
  3 => 'public://color/omtheme-58e01b40/button.gif',
  4 => 'public://color/omtheme-58e01b40/button-o.gif',
);

Similarly, color_themename_logo gives:

array('value' => 'public://color/themename-5cbf1601/logo.png');

I know I want to export color_themename_palette since that's the list of colors.  Is there any reason to export the other three variables?


texts:
I have a workflow system for my nodes, one of the states is "Disable". also there are some flags on those nodes as well, I'd like to know if there's a way to revoke access of author to use flags when he changes the state of workflow to Disable.

Edit: There's a listing of nodes by the logged-in user which is the author, these nodes have different workflow states and different type of flags which each of those flags, does a certain action. In some cases author might wanna change workflow states to different ones, but when he changes the workflow to "Disable", he shouldn't have access to flags on that exact node that has "Disable" state on it.

Changing state to "Disable" revoke access to all flags on that node.
In a rare situation, an admin might change the Workflow state back to something else, which obviously should grant access to the flags for the author, but author himself can't change the state back when he once "disabled" it using workflow.

Example:

Author's list:

Node1 : current workflow state: active, thus accessing to all flags.

Node2 : current workflow state: disable, thus no access to flags.

  Note that Author can change workflow from Active to Disable, not vice
  versa.

  Note2: Also I managed to get a rule to flag the node as disabled if
  the node workflow state is set to disabled, so we might be able to
  use flag only relation as well, for instance if disabled flag is
  flagged, deny access to all other flags of the node.

I'm looking for any solution, contrib module or a custom one, or just combination of modules maybe (Rules & flag), whatever that works!

I'm not sure if hook_flag_access() is relevant here or not.

thanks so much.


texts: Use term reference field in node--custom.tpl.php

texts:
I am building a website with Drupal 7, this website contains a blog. For some reasons I use a custom content type for blog posts call bog_post. In this content type I add a "Term reference" field (is machine name is "field_blog_categories").

To custom the layout of blog post I override node--blog_post.tpl.php. My problem is to display the term reference field. When I print the php var corresponding to that field "$field_blog_categories" I get :

Array ( [en] => Array ( [0] => Array ( [tid] => 8 ) ) )

As you can see the term name don't appear. I thought to get the name by tid. I try

taxonomy_term_load($field_blog_categories['en'][0]['tid'])

but it return nothing.

Any help to get the term name will be appreciate !


texts: How to use User Points for storing Quiz scores?

texts:
How can I add points directly to the User Points database? I have a quiz site and would like to use the User Points module to store quiz scores, instead of creating something from scratch. I have created a taxonomy "Quiz" for such points.

Every quiz ends by showing the score made (between 0 to 100 depending on how many answers they got right). I would like to go on and store this in the userpoint database.

I am using the following code but I'm getting 2 error messages:

  Notice: Undefined variable: user in ...
  Notice: Trying to get property of non-object in ....

The code I am using is the following one:

$params = array (
  'uid' => $user->uid,
  'description' => 'Totals points from quizes',
  'points' => $percentage,
  'tid' =>127,
);

userpoints_userpointsapi($params);


texts: Is there a way to force a fresh page to be served to unregistered users every time instead of the local cached version?


texts: Drupal 7.8, Webform 3.x w/ AJAX - #process callbacks cannot be found for select components

texts:
We've written some custom module code to AJAXify Webforms using Drupal 7's new #ajax actions.

There's one small snag with the forms though. We're returning the form element for processing when it does not validate, and the form is rendered and returned to the client. This works well for everything except for components that require additional processing (using #process callbacks, e.g. webform_expand_select_ids, webform_expand_checkboxes). When the form is submitted via AJAX, Drupal isn't loading Webform's component includes so it cannot find the callback functions.

To get around this, I've added code to the core form.inc to load the component's include file so form_builder() has access to it, which obviously isn't the best way to achieve this. This allows checkboxes/selects to be rendered properly at least.

function form_builder($form_id, &$element, &$form_state) {
    if (module_exists('webform')) {
        module_load_include('inc', 'webform', 'components/select');
    }

...

Is there a way to force Drupal to load a required module when using the AJAX system?

I've used the steps outlined at http://envisioninteractive.com/drupal/add-ajax-to-a-webform-in-drupal-7/ which works well, except for these few issues.


texts:
I have one defined endpoint in Services.

I need to detect if request origin is browser or REST client app in hook_user_login implementation to prevent custom redirect when using service.

My solution is simple strpos() + current_path().

But maybe there is a better way. Not found any for now.


texts:
I got Drupal 8 / Commerce 2 installation, and trying to create product category pages, showing product image, title and price range (min & max price)

I've created product category page with Views. Category is defined as Taxonomy reference field in product.
Views has "Contextual filter", where category name is taken from url e.g. /product/[category].

Product catalog page works fine, showing fields defined in (custom) Summary view mode. It shows title and the first product variation image and price.

Only thing missing is the price range info

I've tried to do some experiments by

overwriting commerce-product.html.twig in custom theme
writing hook__preprocess_commerce_product in custom module

..but with no luck. Debugging is hard because, for some reason kint() / dpm() calls fail or just take tooo long and give execution time out...

So the question is: how and where to check product variations lowest & highest prices plus pass them to product template?

Any hints or ideas are greatly appreciated.

EDIT:

I got it done by adding the following preprocess  hook to my custom module

function CUSTOMMODULE_preprocess_commerce_product(&$variables) {

  $product = $variables['elements']['#commerce_product'];

  foreach( $product->variations as $variation) {
    $prices[] = $variation->entity->getPrice()->getNumber();
  }

  $min_price = min($prices);
  $max_price = max($prices);

  if ($min_price != $max_price) {
    $variables['min_price'] = $min_price;
    $variables['max_price'] = $max_price;
  }

  $variables['currency'] = $variation->entity->getPrice()->getCurrencyCode();
}

... And then in commerce-product--teaser.html.twig

{% if min_price is defined and max_price is defined %}
  {{ min_price |number_format(2, '.', ',') }} -
  {{ max_price |number_format(2, '.', ',') }} {{ currency }}
{% else %}
  {{ product.price }}
{% endif %}


texts: {500 service unavailable (with message)} error when trying to register a user with API

texts:
I want to register a user on drupal site through REST,
I read this article, and implemented the instructtins exactly the same using Postman on drupal 8.3.

specially when I send this specification :

POST: http://example.com/user/register
Content-type: application/json
Data: { "name": [
  {
    "value": "test"
  }
],
"mail": [
  {
    "value": "aa@bb.com"
  }
],
"pass": [
  {
    "value": "test"
  }
]  }

Response is: 500 service unavailable (with message)

What should I do to solve the problem?


texts:
Is there a way to display error message daily to the user saying that "Your subscription Expiry in x days". And this message needs to popup each and everyday.

I can use hook_init()(this will run each and every page load), is there any other hook/option available?


texts:
How can I define the width of the grid of a block using skinr?

I've used skinr in Fusion, now I'm trying to configure it with Skeleton theme.
I've installed Skinr 7.x-2.0-beta1, and enabled all of its modules, but I can only add css classes.

See this other window


texts: Can I remove/hide the "Provide a Menu Link" checkbox when creating new content type?

texts: I am creating a site where authenticated users (not too computer savvy) will be entering in data to the content types we create and the "Provide a Menu Link" may cause them too much trouble.  Is there a way to remove or hide this option when I create my custom content types?


texts: Custom block with a field value that can be used in other twig template

texts:
I am creating a custom block with fields:

field_items_to_show (items to show)
field_logos (images, multiple)

The site editor must have the option to set the amount of items to show in a field.
in the twig field template field_logos I need the value from field_items_to_show

            {% for item in items %}
            {% if loop.index == 9 %} // this value must be set from field_items_to_show

            {% endif %}

{{ item.content }}

            {% endfor %}


texts: Appache solr results multi sites search sorting based on specific feild

texts:
i have four sites and use appache solr module to execute search indexing in these four sites ,
all is ok with me , but the results sort not as i want

i want to sort by fields ......for ex:- get all result that have [field 1] first , then get all results that have [ field 2] ....

in my case , i have some results from [ field 1] then [ field 2] then [field 1] , ....
for note (my field type is taxonomy term and all contents in all four sites are the same )

Thanks


texts:
I'm trying to create two selling price for each products. One is retail and another is wholesale price. For that I have two price fields in my product variation (commerce_price and wholesale price). But when I add a product it was displaying only commerce_price. I want to display both prices. I have enabled both price fields in its display settings also.

Here is the snapshot how it was looking now

Can anyone tell me how can I achieve this?


texts: Displaying a Views Fieldset as a UL rather than a DIV

texts:
With Views Fieldsets, you can display fieldsets with a 'display type' of either div or fieldset.

I'd like to set the display type as ul. Does anyone know how I can do this? I've tried rewriting the output but it didn't work, it rewrote the individual fieldsets rather than the parent.


texts: How to upload new versions of an image with the same access path?

texts:
We have two sites, one is a static HTML site. Another is an Drupal site. For example:

www.my-html.com
www.my-drupal.com

On the my-html.com site, we have a dynamic image banner, links to a JPEG on the my-drupal.com site, which can be managed by the user using Drupal CMS, i.e.:

http://www.my-drupal.com/sites/default/files/my-html_banner.png

The users can upload new versions of the my-html_banner.png from time to time. Hopefully, when a new version of the image is uploaded on my-drupal.com, it will be refreshed on my-html.com.

However, the newer versions of the .png will end up with different filenames in sites/default/files, i.e.:

my-html_banner.png
my-html_banner_0.png
my-html_banner_1.png
...

Is there a way to use a fix path to refer to the latest version of a uploaded image? Or is it possible to config Drupal to replace existing image if the uploaded image name is identical?


texts: How do I programmatically disable the pager?

texts:
I'm using a view with infinite scroll. I want to disable the pager for the default view and keep the pager if we select some options from filters.
Can we do it via code?


texts: Can I skip or bypass translation when creating a form #options elements?

texts:
I know I must use t() function in Drupal, but my particular task involves a great number of values in Russian, for which I do not want to enter values as
    t('Moscow')
and then manually translate strings into Russian. There are tons of Russian names and I just want to use them directly. Is it possible?

When I try, my select element options just appear blank.

...
       $form['selected'] = array(
           '#type' => 'select',
           '#title' => t('Selected'),
           '#options' => array(
              0 => 'Чебоксары',
              1 => 'Москва',
           ),
...


texts: Specified template file for user-profile-form based on role

texts:
I use drupal 7.x and field_group and nultiple registration module.
How I can use a template file (.tpl) for user-profile-form only based on roles.
in other words when a user with A role login to site and go to user/%/edit page see a specified form with specified fields. and When user loged on with B role have another form for edit information.field permissions control fields but field groups is visible yet because field_group module have a bug with field_group_multiple module.

So , I want to use specified tpl file for user-profile-form (no registration page or profile page - only user-profile-form )  by role  .
Can you help me ?


texts: Drupal 7: VBO and Rules Component to update Node fields

texts: I have a content type called 'Course' with subpages. In one of the subpages, a view is displayed. The view displays the node information of content type 'Learning object'. By Views Bulk Operations, I'm able to send the nids of selected rows of the view to Rules Component. But, what I want to do is store the nids of selected rows in a field of 'Course' type node in which that view is present. How can I send the nid of the page in which view is displayed to Rules Component?


texts: How to deploy a module locally for testing?

texts:
I'm currently developing my first custom module for Drupal 7 and am having a hard time finding documentation about the available local deployment strategies.

I have a custom module project, consisting of my modules sources, a gulp file and some other things of less interest (README, .editorconfig, ...). When I make a change on my source code, my gulp builder automatically deploy the changes to my local Drupal installation (the document root), in the folder where my custom module is installed.

Now, I would like to test my changes, and that's where I'm stuck: changes that are part of the install hooks of the module (adding fields, custom nodes, and so on) don't appear on the website. I have to disable my module, uninstall it, resinstall it and enable it to see those changes. This is a very long and painful process.

Even using drush commands to achieve this, the disable, uninstall, install and enable process is very long, meaning I'm losing a lot of time waiting for Drupal to manage my module, even for the tiniest source code change.

And of course, in any case, I have to recreate every content I had previsouly created to test my module.

Is there a strategy to allow near-realtime deploy and testing when developing a custom module ? How are you guys dealing with this ? Is there at least a drush command to replay the install hooks of my module ?

Thanks by advance.


texts: I created two gallery with different content type and different views (gallery1 & gallery2)...and i want to make it in one gallery containing one image of each gallery (one of gallery1 & one of gallery2)...   please help me with video or something else...and tell me what i have to do ?              i use Drupal 7               & thx


texts: In Drupal 7, how do I display my taxonomy term fields while creating content when using a checkbox field?

texts:
I currently have the following below as a taxonomy reference field in one of my content types as a checkbox list widget during content creation.

Currently its only showing the term name, but I want it to show the term name and its fields. My end results would be something like this:

nc - North Carolina

nj - New Jersey

ny - New York

How can that be done?


texts: I have two content types movie types(say comedy, horror, action are node titles) and movies. where I am using movie types node titles as a node reference in the movies content type. here user can subscribe to the movie types and can watch all the movies under the type. Now where i am stuck is to send a mail to the subscriber when new movie is uploaded under the type he/she subscribed. Please help me to sort out this issue.


texts: Is there an easy way to display Atlassian Gadgets within a Drupal node?

texts:
We are looking into a way to display information from Jira in Drupal.

Using Drupal 6, is there an easy way to display Jira/Atlassian Gadgets within a Drupal node?

I have looked into a few things, and while it seems that the Dashboard module allows to include Gadgets, I don't want to have to use a Dashboard for this. I just wanted to embed a Gadget into a normal Drupal node.

Any hints or ideas?


texts:
I bought a module on Envato. I've already contacted the developer, but he does not respond. The module outputs some vertical tabs.

They are created with this code.

/**
 * Implements of hook_builder_content_info()
 */
function builder_builder_content_info() {
  $blocks = _block_rehash();
  $contents = array();
  if (!empty($blocks)) {
    foreach ($blocks as $key => $block) {
      $contents[$block['delta']] = array(
        'info' => $block['info'],
        'type' => 'block',
        'group' => t('Block'),
        // This is name of group to collect contents in a tab
        'block_module' => $block['module'],
      );
    }
  }

  // node add content
  $contents['node'] = array(
    'info' => t('Adding existing node'),
    'group' => t('Node'),
  );

  //Custom text
  $contents['custom_text'] = array(
    'info' => t('Custom text'),
    'group' => t('Text'),
  );

  // Custom heading
  $contents['custom_heading'] = array(
    'info' => t('Custom heading'),
    'group' => t('Text'),
    'no_title' => TRUE,
  );
  // Insert image
  $contents['image'] = array(
    'info' => t('Insert an image'),
    'group' => t('Image'),
  );

  $contents['youtube'] = array(
    'info' => t('Youtube'),
    'group' => t('Video'),
  );
  $contents['vimeo'] = array(
    'info' => t('Vimeo'),
    'group' => t('Video'),
  );

  $contents['icon'] = array(
    'info' => t('Icon'),
    'group' => t('Icon'),
  );
  return $contents;
}

I can rewrite them in my own function, but I have no idea how to remove them. I thought through $contents['custom_text'] but I'm not sure. Of course, I can remove the original code, but I do not like it.

It looks like unset($contents['custom_text']) is working, but can I run this from another file/function?

EDIT

/**
 * Implements HOOK_builder_content_info_alter()
 */
function builder_gc_builder_content_info_alter(&$contents) {
    unset($contents['node']);
}


texts: Get information from a node that has just been saved to update a different node

texts:
I have 2 different content types "factory" and "measurement" that are related with an entity reference field. I am using a computed field to store the latest measurement as a field of the factory content type. The problem is that in order for the computed field to be "re-computed", the factory node that the measurement refers to, needs to be updated.

My first thought was to batch update all the factory nodes in predefined intervals. This has a very important downside: the factory information (and specifically the latest measurement that I'm interested in) will not be updated until the batch update is executed.

My next thought was that I could use a hook whenever a new measurement is created and update the corresponding (=the one that the entity reference points to) factory. The problem is that hook_node_insert will not give me the information that I want (i.e. the entity reference field that points to the factory) since in the hook's description it states clearly that:

  You should not rely on data in the database at this time as it is not
  updated yet.

Is there any other way to execute a piece of code whenever a new node of specific type (i.e. measurement) is saved/created and have the node's fields available in my code? How do Rules do it?

P.S: I thought about using Rules but it seems like an overkill for such a simple thing to install a pretty heavy module.


texts:
Should I be paranoid about creating new content types or should I create them for each new content type I come across.

My particular scenario is having several distinct blogs on my site.

Kitchen Blog
Gardening Blog
Wine Blog

I could have each of these as a standard blog type and just ask the person to remember to set the correct tags. I know I can set up a view to only show each blog with the correct content type but it all seems  a bit messy.

Alternatively I could set up a content type for each based on the blog, then I can set a custom template to look differnt for each blog.

We currently have about 10 content types on the site, could I go to 30 without worrying too much about performance or anything else?


texts: How to set different paths to different images on the same views block

texts:
I have a situation where I have a block with 3 Images and links in the front page set in a block (drupal 7)
and I am trying to make each image and link to point to a different section in the site
but I can't :( I only managed to make them all point to the same page or to divide each to its own block (with views)
but then it doesn't look so good visually...

is there a solution for that?
Thanks


texts:
When I'm use the image_style_url(), function I got this token at the end of the URL: ?itok=yjoxJwQh.

Drupal uses a different token for styles and script, eg ?mk4o7m.

How does this affect caching and SEO?


texts:
I'm creating a website which has 2 type of categories. One for the Catalog (product type) which works well and I created a Company taxonomy catalog too. If I create a product I can select the Product type and the Company. So I created a navigation for the catalog and for the company. If I click on the catalog product type it works great it shows the products which I added inside that catalog but if I click on the company it says that the taxonomy is empty and the product is not showing there. What can be set up bad here ? Im totally confused. (I'm creating Filters with Views).

Anybody got tips for this small error ? Thank you


texts: Some field collection items not editable by admin

texts:
My Drupal site has developed a very strange problem. For some reason I cannot edit field collection items of certain sites on their own edit URL, but others work fine.

For example:

/field-collection/field-collecton-type-a/1/edit   <-- Works fine, displays a form and I can edit the item

/field-collection/field-collecton-type-b/2/edit   <-- Displays "Access denied: You are not authorized to access this page."

There are no obvious differences between the field collection items. Sometime I have even noticed that within one particular type of field collection, an individual item can sometimes be edited and at other times it can't.

I have tried the following:

Clear the cache completely many times
I am logged in as admin, but just in case I completely rebuilt the permissions and gave admin access to everything
Exported the field collection using Features and then re-imported it

Really scratching my head with this, and would appreciate any suggestions as to what to try next.


texts: Fetch user id on behalf of the non-drupal php

texts:
I want simply to provide user id to php application that resides under my files/ folder. It is php that one flash app uses to create xml. This script, in my drupal root folder, works:

<?php
define('DRUPAL_ROOT', getcwd());
require_once '/var/www/drupal/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
$user_uid= $user->uid;
echo $user_uid;
?>

but when i try to include whole script in that php app in my files folder, it fails, with many include type errors.

I am searching for simple solution to provide that app with user id!

Thanks!


texts: Aegir Installation - how to get the sender email correct to allow install to pass

texts:
During the Aegir installation procedure, the
sudo apt-get install -y aegir3 aegir-archive-keyring

step runs through a series of installation commands that eventually try to send an email from the aegir user to the aegir user.
Depending on my build environment this may work or not depending on whether the the aegir user is set up as a valid email sender.  I already have the sending email squared away with MSMTP and can send email from my command line but the installer seems to always be assuming the sending is aegir@hostname.
It would be very nice if I could figure out how to 1) override the sender in the installation script or 2) set the email address of the aegir user manually via CLI.
You'd think that 2 would be very easy to find on the internet but, believe it has been anything but easy.
Does anyone know how to alter the apt-get install of Aegir to pick up the sender email address from some environment variable?
Thanks


texts:
I am using the Views and the Views conditional modules to display an alert message 3 months before the ending date is coming, but it does not work. For example the ending date is 12/10/2016(m/d/Y) and I want an alert shows before that 3 months such as 09/10/2016(m/d/Y). So this is my views

This is my Views condition


texts:
I try to add state "visible" on tableselect in a drupal 8 form
public function buildForm(array $form, FormStateInterface $form_state) {
$form['monselect'] = [
   '#type' => 'select',
   '#title' => $this
     ->t('Select element'),
   '#attributes' => [
     //define static name and id so we can easier select it
//         'id' => 'monselect',
     'name' => 'monselect',
   ],
   '#options' => [
     '1' => $this
       ->t('Article'),
     '2' => $this
       ->t('Page'),
   ],
 ];
 $form['table_article'] = array(
   '#type' => 'tableselect',
   '#header' => $header,
   '#options' => $options,
   '#attributes' => [
     'id' => 'table_article',
   ],
   '#empty' => $this
     ->t('No users found'),
   '#states' => array(
     'visible' => array(
       ':input[name="monselect"]' => array('value' => '1'),
     ),
   ),
 );

I have try with email input and i have not problem
$form['example'] = [
      '#type' => 'email',
      '#title' => $this->t('Example'),
      '#default_value' => $this->config('projetfinal.settings')->get('example'),

      '#states' => array(
        'visible' => array(
          ':input[name="monselect"]' => array('value' => "1"),
        ),
      ),
    ];

Do you know if it's possible to add state visible to a tableselect input form ?


texts: Unique Fields with the ability to be a reference to multiple records

texts:
I wonder to know is it possible to have an unique field (let consider a text filed), when we input a data into it firstly it check the table if it doesn't exist add a record, if it find a record refer to it?

i.e.: I have a field in my content type to store telephone number whenever I want to add a new node, after entering the data into the telephone field if the number was stored in my database instead of creating a new record in the table I just reference to the number

My aim is to have a contact list of some users that submit a form but I don't want duplication (just unique phone number and name)


texts: How do I get arguments from the URL? in other words, what is the equivalent of the arg() function of Drupal 7 and previous versions?


texts:
I want to customize the user-edit page. So in my template.php in my custom theme i direct Drupal to look for my custom template as:

function mytheme_theme() {
return array(
// The form ID
'user_profile_form' => array(
// Forms always take the form argument.
'arguments' => array('form' => NULL),
'render element' => 'form',
'template' => 'templates/user-profile-edit',
),
);
}

This works fine as Drupal is able to pick my custom user-profile-edit.tpl.php. Inside that file i have rendered some elements as :

<?php

print render($form['form_id']);
print render($form['form_build_id']);
print render($form['form_token']);

print render($form['field_birthday_user']);
print render($form['field_real_name_user']);

And so on.I have two questions...How do i get the user picture field, username, password, and email id fields to edit and how do i get to save the profile, i.e., how to get the save button. For the first part i tried doing:

print render($form['account']);

However, this does not displays the user picture.

For the second part, i tried doing this :

<input type=”submit” name=”op” id=”edit-submit” value=”Save”  />

at the end of my custom user-profile-edit.tpl.php. However i get an error regarding syntax.

Would appreciate any suggestions especially regarding the user picture thing.

Thanks


texts: Redirect a view page to another view page with arguments in the url

texts:
I have a custom view with button in the main tab placed in the local_task tab bar area (Outcomes). I have sub local_task navigation items under that as well that are regular drupal views. (See below)

View | Edit | Outcomes
                     Outcomes Viewer | Custom View | Another Drupal View

When you click on Outcomes you are taken to the Custom View tab or the Default for that custom view. However I want to redirect the Outcomes tab to go to the Outcomes Viewer tab. The Custom View tab is the /default for the menu, so it is s separate link and should work.

However, you can not use /%/ in a redirect. Does anyone have any ideas on how to do this. I have tried the basics but am lost on how to make it work.

Thanks!


texts: Why doesn't batch API run for user deletion?

texts:
On a client's website, batch operations don't run when cancelling/deleting a user account (No progress bar shows up and no process runs). Neither of the users have any content related to them as they're accidental duplicates. There are no related error messages in the logs or on the batch page. There isn't any issue when deleting users on the local copy. (This leads me to rule out corrupt include files.) Why does this happen on the live site and not locally?

The problem started after a core update, so another update might not solve the problem.

What I've tried:

Check file permissions on /includes/batch*.inc (r-xr-xr--)
Backup and truncate the batch table, followed by a cache flush
Disable JS aggregation, as suggested in "Can't Get Batch Process to Start/Complete Any More". However, this removes the administration menu.
Use the /devel/php page to run user_delete() for the users in question. However, I don't want to advise my client to run this.


texts:
Is there a module and/or jQuery solution how to show multiple images in a block like the Facebook gallery on people's timeline? The images are always well aligned regardless of their size and landscape/portrait position.

I'd like to use a similar approach for my blog articles - Upload like 3 or 4 images and some text. I included a screenshot of a Facebook post to give you an example of what I mean.


texts: Why are there "updates" to dev versions of modules that do not include any changes to the code?

texts:
When I used drush to check for updates to my site, which has about 100 modules installed, I was informed that the dev versions of several versions of the modules had updates.

However, when I updated the new version, the only thing that was changed was the packaging information and datestamp.

For example, this is the git diff for the Prepopulate module dev version:

-; Information added by drupal.org packaging script on 2013-05-25
+; Information added by drupal.org packaging script on 2013-10-01
 version = "7.x-2.x-dev"
 core = "7.x"
 project = "prepopulate"
-datestamp = "1369450574"
+datestamp = "1380623732"

That's it-- no actual changes to the code.  If this was just one module, I wouldn't think much of it.  However, I had several modules like this-- the Role Expire module, Views PHP module, PHP Mailer module, i18nviews, and there may be more.

It's pretty frustrating for me to download each of these updates and do a diff, only to see that nothing has changed.  I feel that I am really wasting my time.  Are the maintainers doing this?  Does this have anything to do with Drupalcon?


texts: How do I instantiate a custom class with dependency injection?

texts:
I am relatively fresh to the DI party and am struggling to get my head around how exactly to use Dependency Injection.
I understand that I can pass requirements as part of a service, but what about in my own class?

Say I have the below class where I want the language manager service to be injected:

class Foo implements ContainerInjectionInterface {

  protected $languageManager;

  public function __construct(LanguageManagerInterface $languageManager) {
    $this->languageManager = $languageManager;
  }

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('language_manager')
    );
  }
}

When I call new Foo() I am required to pass an instance of LanguageManagerInterface. That makes sense in terms of a normal constructor method, but that would require me to instantiate the class like the below:

$languageManager = \Drupal::service('language_manager');
$foo = new Foo($languageManager)

That just doesn't feel right to me.

Is there something I am missing, or would this class always have to be a service to take advantage of dependency injection?


texts: Can't select image in CKEditor in order to apply style

texts:
Not sure this is connected to Drupal, but since I'm using CKEditor within Drupal, I'm asking here first because sometimes, using a feature in Drupal seems to change behavior.

In the empty body field of a node, I click the "Insert images using Imce File Mangager" button (which I have included in the CKEditor toolbar).
At the IMCE file browser window, I select an image, give it Alt text, and click Save.
The image appears in the editor window. The html is

Now I want to apply a style from the Styles drop-down (which I have also included in the toolbar) to the image.
I click the image to select it and a blue border box appears around it.
I click the Styles dropdown. None of the image styles I have defined show up (which is the expected behavior when no image is selected).
If I double-click the image, I get an "Edit Image" dialog box where I can edit the image properties (same as when I right-click the image and choose Image Properties).
If I double-click out to the right of the image, instead of getting the blue box, the image appears to be selected.
In this case, my image styles do show up in the Styles dropdown. However, selecting a style does not apply it to the image, reason being that when the image appears to be selected, it's actually the paragraph containing the image that's selected. Thus, the img style isn't applied, because img styles can't be applied to paragraphs.
Once in a while, for reasons I haven't been able to nail down, some sequence of toggling into and out of Source mode and/or changing what's in the toolbar and/or something else I do makes it so that I CAN click directly on the image to select it. In this case, I CAN apply a style from the dropdown to the image and it works beautifully.
But even when image styles start working like this, pretty soon they stop working, again for unknown reasons.

Any suggestions on how to make it possible for editors to apply a style to an image will be greatly appreciated. None of the many posts I've read address this issue.


texts: How to hide "Manage Fields" and "Manage Display" tabs

texts:
I'm making a website with Drupal 7, and I was looking through the permissions for Taxonomies. I wanted to give the website maintainers a central place to manage the vocabularies and add terms, sort the terms etc. So I gave their role the "Administer vocabularies and terms" permission under Taxonomy. This however resulted in an unwanted complication, mainly it gave them access to create new fields and manage their display ("Manage Fields" and "Manage Display" tabs).

Is there a way to give them access to the Vocabulary and Term edit screen which can be accessed through "Structure > Taxonomy" but however disable the "Manage Fields" and "Manage Display" tabs on the vocabulary edit screen?

I'm quite familiar with the notion of overriding and hooks in Drupal 6, but I'm quite new to Drupal 7 (in fact this is my first D7 website, made about 5 or 6 D6 websites) so I don't mind some coding solutions to this if any. Just looking for an answer or a push in the right direction.

Since no one has answered yet, I wanted to add that I'm willing to look into alternatives to the central area to manage taxonomies (admin/structure/taxonomy). Maybe I could look into creating a page with Views to simulate the taxonomies admin page.

Is it feasible and has anyone done anything like this before?


texts: Workbench Moderation: Published data overriding draft data on draft view

texts:
Moderation's draft content not showing on the front end.

When a node has both a published and a draft, the data from the published overrides the draft data on the front end when viewing the draft.

For example www.example.comnode/6
and www.example.com/node/6/draft
will display identically.

Does this require a special hook in the theme?


texts: How to create a new role with authenticated user permissions

texts:
I want to create a new role. New role should have all the permissions of authenticated user as well as the some new permissions.

I used the following code,

$role = new stdClass();
$role->name = 'New role';

// load the authenticated user role
$auth_role = user_role_load(DRUPAL_AUTHENTICATED_RID);
$role->weight = $auth_role->weight + 1;

user_role_save($role);

and I will assign the permissions using user_role_change_permissions() or user_role_grant_permissions()

Now I want to assign the authenticated user permissions to this new role. How to achieve this?


texts: How to construct a content type that would be useful for creating a "When is this store open" view

texts: I would like to create an hours content type that could be attached to an individual location.  The goal is to create a page that a customer could visit to find which of the stores are open today, along with the times that they are open.  This would also reflect closures for holidays.


texts:
Cache table's size had increased to 10+ GB last month, and I had fixed it temporarily by truncating it. Last time I checked it was around 1GB. So in couple of months it will hit 10GB again. How should this be dealt with ?

Note that I have disabled all cron jobs on this site. If this is the reason, which cron should be enabled ?


texts: Can I use drush to compare the running modules on two sites on the same server?

texts:
Is there a way to use drush to compare the list of running modules on two Drupal 6 sites?

I have two sites running locally (with two code bases if that matters) with different modules, but a very similar odd problem (discussed about here). In trying to find the modules that might causing this problem, it would be really helpful to get a list of modules that are running on both sites.


texts: Possible to run views_embed_view() for a specific role

texts:
Without having to user_load(SOME_UID_THAT_HAS_MY_INTENED_ROLES); and swap the current $user object and then replace it.

Is it possible to say,

views_embed_view('view_of_articles');

But tell it to respect the permissions of a certain array of roles like,

views_embed_view('view_of_articles', array(SOME_RID));

I know the above wont work since the function isn't defined in such a way, but could this be possible with theme() functions, or something else I'm missing?


texts: What's the easiest way to dynamically set  on a per request basis?

texts:
I need to be able to set the front page based on the current language (derived from domain) and brand (also derived from domain).
I initially tried to set this up with views, but I need the front page to be rendered as a "real" node - and not as a view. This is because the rendering of the page header and footer depends on the node being viewed. So this did not work as expected.
What is the easiest way on a per request basis to set the internal path which e.g.  should resolve to?


texts: Use description value from term reference in Rules

texts:
I have a taxonomy list with fields title and description.

In the account settings I have a term reference to the taxonomy list.

In my rules I have a rule when user is logged in. I want to do a page redirect to the page the user has set in his settings. But not the title but to the description.

If I do the standard he redirects to the title. But how can I make sure he redirects to the description?


texts:
Apparently one of the modules installed on my drupal site has been sending SPAM emails from my server as in (name)_(lastname)@(myservername).com , it managed to send 1000 email and queue 97,000 emails only in the first day..

At first, based on the email details, I figured it was being sent from a PHP page called diff.php under /sites/all/modules/contrib/libraries/tests/libraries/diff.php, so I deleted the whole tests folder, but now the emails are heading directly from my root site..
I have installed Hacked! to a development copy, and here's a copy of the results:

Does it seem like a module issue? should I re-install the changed modules?


texts: After restoring the database from the live site to development site, the administrator users fails to log in

texts:
I want to refresh my DEV site with data from LIVE site.
(both sites have same modules because I play with new modules on my DEV site before I install/enable modules on the LIVE site).

I have set the database configuration to be exactly the same (except localhost for my dev site).
So I dump my database from live site and restore it on my dev site.
(I know I miss some files but I don't care about that.)
All is fine: I can view the dev site with data from the live site, until I try to login as administrator. There is no way to login, no error message; I am simply not logged in.
The password for the administrator user is the same on both the sites, of course.

I checked the hash of the passwords which are different in table users.
I assumed it was due to some salt, so I also copied the salt from sites/default/settings.php
It does not help: The administrator login is still impossible.
Then I reset the admin password on my dev site as explained in http://drupal.org/node/1023428, but it doesn't help: There is no way to log in.

What did I miss?


texts:
I' trying to set up CKEditor options as in the following screenshoot:

Everythings works fine except the alignment buttons:

I saw that an issue (2649546) about this has been created but it seems that is still pending.

Any suggestions about how I could solve this?


texts: Set node action for specific content type

texts:
I want to set a trigger to redirect when a node (or comment) on a certain content-type is created.

I have 2 hurdles here:

The Trigger module doesn't seem to offer any distinction between content types. Will I have to write some sort of hook?
I can create an action to redirect to the specific URL, but it always shows up under the 'system' category and is then not in the dropdown list when I go to set it for creation of every content type.


texts: Is necessary any sanitization functions if I use the database layer correctly

texts:
In Writing secure code said:

  Use the database abstraction layer to avoid SQL injection attacks

Then, my question:

When I get value for a user form is necessary pass to check_plain() or others sanitization functions, before I use the database layer correctly.


texts: How to copy blocks placement and settings between themes?

texts:
How can I copy blocks placement and settings between themes?

I've found this module: https://drupal.org/project/blockregion and this code to do it in the database. But both are for D6. How can I do this for D7

First, clear the existing block information for the new theme:

DELETE FROM blocks WHERE theme = 'NEW_THEME_NAME'

Now, copy all the block information from the old theme:

INSERT INTO blocks (module, delta, theme, status, weight, region, custom, throttle, visibility, pages, title, cache) (SELECT module, delta, 'NEW_THEME_NAME', status, weight, region, custom, throttle, visibility, pages, title, cache FROM blocks WHERE theme = 'OLD_THEME_NAME')

Also found this, but for D5: http://pierrerebours.com/blog/duplicating-block-settings-across-themes-drupal


texts:
I'm building a custom form that will show some details from a web service.

On my page callback I have two fields and submit button:

<?php

$form['starting_date'] = array(
   '#type' => 'date_popup',
   '#title' => 'Starting date',
   '#date_format' => 'd.m.Y',
);

$form['end_date'] = array(
   '#type' => 'date_popup',
   '#title' => 'End date',
   '#date_format' => 'd.m.Y',
);

$form['submit'] = array(
   '#type' => 'submit',
   '#value' => t('Check'),
   '#submit' => array('reports_list'),
);

On

<?php
function reports_list($form, &$form_state) {

}

I'm inserting the code that connects with the web service, passing the form_state values of selected dates and after that I'm trying to display the table with the web service details on the same page, but after clicking on submit it simply refresh the page and doesn't show anything.

I can see connecting with the web service is successful.

On custom submit function this for an example is not displaying:

<?php

$form['results'] = array(
   '#type' => 'markup',
   '#markup' => '
TEST
',
);

I'm doing something wrong, I guess...

EDIT: I've tried to display something in the submit function like this:

<?php

$form['results'] = array(
   '#type' => 'markup',
   'markup' => 'TEST10',
);

echo render($form['results']);

It's not working.


texts:
I have two questions, both related to rules

1) It seems, all of a sudden and no idea why, 'When an order is first paid in full' is not triggering anything. I have a custom payment method, which worked fine till today. I can confirm that commerce_payment_transaction_save works and updates the order with payment information and status changes to 1. So I don't know why 'paid in full' event stopped working.
I am still able to trigger 'Completing the checkout process' event without problem.

2) Is there any module or perhaps an existing devel configuration that would allow to see rules log? Or debug by rules/events/actions?


texts:
In this presentation, slide 13 says (emphasis mine):

  The relationships between Entities- the ways entities can interact either
  each other - define our Drupal application

  nodes can have comments
  users create nodes
  taxonomy terms are attached to nodes

  these relationships are implicit - perhaps they should be explicit?

What does the last sentence mean?  In Drupal, what makes entity relationships implicit rather than explicit?


texts: How do I bulk delete field collection items that are part of a content type?

texts:
I have a Drupal 7 site with a content type that is for adding courses and courses have a field collection that has multiple fields for Date, Venue, Location(Province)

Each course can have 1 or many dates, venues and locations and these get updated, usually by the company offering the course(User managed content). I can update the course content and field collections for them using feeds module but the problem I have is that the old dates are not being overwritten. So we end up with old dates which are no longer relevant plus the new dates.

The question, is there a way to delete the old dates in bulk? I can't seem to get VBO and views to do this. Am I missing a module that would allow me to select all the field collection fields for a particular node and delete all without having to delete them 1 at a time?


texts: How do I delete a Panopoly landing page?

texts:
I was able to disable the page by going to admin/structure/pages then clicking Disable. However, I am not sure how to delete the landing page.

Note: I am running Panopoly on Pantheon.


texts: How to send an email to multiple recepient with contact form?

texts:
I want to send an email to multiple recepients when the contact form is submitted. By default when contact form is submitted it is sending mail to default email id which is saved in system configuration.

How can we add multiple email addresses which will receive messages when any user submitted the contact form?


texts:
I need to set time limit to edit comment, like Stack Overflow strategy that sets 5 minutes time limit. The Time Limit on Comment Edit asked the same question and the Edit Limit was proposed.

In admin/people/permissions I allow authenticated users to Edit own comments and also Installed Edit Limit module. This is the configuration

Despite of letting the contents to be editable in 3 minutes, Users are still unable to edit their own comment right after sending their comments. What is the problem? Is there any other solution?


texts:
I am trying to use Feeds to import data from a CSV file. However, the file I've been provided with, even though its type is "Microsoft Excel Comma Separated Values File (.csv)", the values are separated by a pipe | character instead!

Will this work? Or will it corrupt the database?

The reason I ask this is because in the Select a parser section one of the options is CSV parser (parse data in comma separated value format) and that is the only one that I can see would suit me... except for my pipe separated values format ...


texts:
So I've been fighting with this for a little bit, and I've been unable to get help from Google, so it's time to ask some experts!

I'm setting up a small business website; we're aiming to create something that's very simple now, and easy to grow as the business grows. Drupal fits the bill nicely, but it's fairly new to us. I'm trying to set up three simple layouts: a basic page (Header, Main Content, Side Bar Menu, Footer), a splash page (Header, Side Bar Content), and a product page (Header, Side Bar Content, and Footer). Nothing overly ambitious, but also not supported by Drupal  7 out of the box (as far as I can see, at least).

I tried experimenting with themes and subthemes, and played around with the Zen theme for a bit to limited success, but no variable layouts. After some digging, I think CTools + Panels is what makes the most sense, and I can get the layouts I want, but I can't figure out how to get the panels to display any actual content.

Is there an easy way to execute this plan with Panels, or should I be investigating a different option?


texts: Hide the block on the "node/add/my_content_type" page

texts:
I created a content type. I want to show a block on all nodes of this content type except "node/add/my_content_type". I used the following PHP code:

global $node;
$arg1 = arg(1);
if ( $node->type == 'my_content_type') && arg(0) == 'node' && is_numeric($arg1) ) {
  return TRUE;
}
return FALSE;  //default

Result: the block does show on all nodes of this content type, but also show on "node/add/my_content_type".

What I did wrong? Thanks for any help.


texts: How can I use a custom logo image in Drupal 8 that is language dependent? There does not seem to be an appropriate setting in the Content and Language Translation configuration page.


texts: How do I use block_view_alter for the template file?

texts:
I want to alter a view block. I used hook_block_view_alter(), but this is not working in a template theme Drupal 8.

How do I use hook_block_view_alter() in template theme?


texts:
I am setting an alias programatically, using path_set_alias() in Drupal6.

Looking at the code of path_set_alias in path.module, I see that if I pass the pid (path id), the old alias(s) for that node will get deleted, which is what I want.

When I load the node, though, I see no pid property set on the node, but the record for the node's alias exists in url_alias table.

Why doesn't pid exist on the node object? Must I retrieve the pid from the url_alias table and then pass that in to path_set_alias to remove the old alias?


texts:
I have a web service on third party system that return property of doctor and I have a content type named "doctor".
I want when user go to a url like doctor/23 drupal create a node of type doctor based on url arg and show this node to user.
for that and with @zaporylie help i create a custom controller like bellow

create a Routing:

    showdoctor.load_doctor_controller_load:
  path: 'doctor/{doctor_id}'
  defaults:
    _controller: '\Drupal\showdoctor\Controller\LoadDoctorController::load'
    _title: 'load'
  requirements:
    _permission: 'access content'

and my controller like this:

    class LoadDoctorController extends ControllerBase
{
    public function load($doctor_id)
    {
        $result = RestCurl::post("http://myrest_server.com", [
            'filter' => ['doctor.id' => $doctor_id],
        ]);

        $fullname = $result['data']->message->data[0]->firstName;
        $fullname = $fullname . ' ' . $result['data']->message->data[0]->lastName;
        // Fetch doctor node with EFQ
        $query = \Drupal::entityQuery('node');
        $query->condition('type', 'doctor');
        $query->condition('field_doctor_id', $doctor_id);
        $nids = $query->execute();
        if (!$nids) {
            $node = Node::create([
                'type' => 'doctor',
                'title' => $fullname,
                'uid' => 1,
            ]);
            $node->set('field_doctor_id', $doctor_id);
            $node->save();
            $element = array(
                '#markup' => $node,
            );
            return $element;
        } else {
            $element = array(
                '#markup' => $node,
            );
            return $element;
        }
    }

}

Now for example when in go to doctor/23 page i see a page with load title. and if i refresh this page i see doctor page correctly. i think my problem is return value.


texts: How should I include an image field from a taxonomy term in a node view?

texts:
I'm creating a site with just one content type sorted in three categories and posted by three different organizations (no matter in which of the categories). The front page has to be three columns displaying the content of each category.

The nodes has to be distinguished by the logo of the organization. I'm trying to solve it by managing the organization as a taxonomy and creating an image field for each organization/term; when I deal with the view, I find that I just can use as field the name of the taxonomy and not the image (creating a view of node type of course).

How can I achieve it?