texts: Creating new users with Commerce & Rules: ERROR

texts:
Commerce has a problem with the Rule to create a new User account for an anonymous order:

ERROR: Missing configuration for parameter param_field_[fieldname]

According to a drupalcommerce.org comment this is because of fields being required:

  The rule “Create a new account for an anonymous order” will fail if any of the fields it attempts to create are required. That failure will generate the ERROR: Missing configuration for parameter param_field_.

Despite this insight, no answer is give for how to take care of the error. It is necessary to my site to require some fields upon user registration. How can I get rid of this error?


texts:
in EntityListBuilder::buildRow we can define row like below:

$row['title']['data'] = array(
    '#type' => 'link',
    '#title' => $entity->label(),
    '#suffix' => ' ' . drupal_render($mark),
    '#url' => $uri,
  );

question is: where can i find list of the options/parameters documentation of this? (#type, #title, what is the other possible option?)


texts: Views Content: Title as an autocomplete exposed filter?

texts:
I would like to provide an autocomplete widget for the Content: Title in a view (created by Views), in which this field is an exposed filter. By default, it's a simple textfield.

What's the best solution for this?


texts: unable to create new draft programatically for published node

texts:
I am using workbench_moderation module.

When I edit the node and save it using node_save($node) it is changing the status of actual node to draft and original node is getting unpublished.

While I want to keep original node as published and want to create new reversion in draft status.

I used below code too but it is not working form me(It is immediately publishing my changes).

node_save($node);
workbench_moderation_moderate($node, 'published');


texts: How do I get a textarea form field to use a full HTML WYSIWYG editor?

texts:
I have configuration form for a custom module.

namespace Drupal\amu_http_status_code_display\Form;

use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;

class AmuHttpStatusCodeDisplayConfigForm extends ConfigFormBase {

  public function getFormId() {
    return 'AmuHttpStatusCodeDisplayConfigForm';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {

    $config = $this->config('amustatuscode.settings');
    $form = parent::buildForm($form, $form_state);

    $form['404_message'] = array(
      '#type' => 'textarea',
      '#title' => t('404 error message'),
      '#description' => t('error 404 message.'),
      '#default_value' => '404 error',
    );

    $form['403_message'] = array(
      '#type' => 'textarea',
      '#title' => t('403 error message'),
      '#description' => t('error 403 message.'),
      '#default_value' => '403 error',
    );

    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $config = $this->config('amustatuscode.settings');
    $config->set('404_message', $form_state->getValue('404_message'));
    $config->set('403_message', $form_state->getValue('403_message'));
    $config->save();

    return parent::submitForm($form, $form_state);
  }

  public function getEditableConfigNames() {
    return ['amustatuscode.settings'];
  }

}

How can I make the form field I add use a WYSIWYG editor?


texts: How do I pass the UID in URL to embedded View?

texts:
Probably a stupid question, but I'm stumped... I have a simple View which lists all terms from a Taxonomy. Within this is a Global Field Type of "View" which is trying to list any content related to the Term, and authored by the UID present in the URL. However I am unable to pass the parameter from the URL to the View using standard Replacement Patterns. I can pass the Term using [!name] but not a parameter from the URL.

So parent view URL is /report

This is called with the UID appeded, e.g.: /report/34

How do I get 34 passed to the embedded view as contextual filter?

Many thanks for any help on this seemingly simple use case!

****** ANSWERED ********

Check Alfred's answer below, but also make sure the order of your Contextual Filters is correct. In this case, I was passing a blank value, rather than NULL value, as the first parameter from the parent view.

Swapping the order of the Contextual Filters over mean't I could pass a NULL value from the parent view (i.e. just the first one). Hope this makes sense.


texts:
I'm using the Russian localization for Drupal sites and everything seems to be finely translated except the comment form (while viewing a node).

The field "Subject" is translated but the field label "Comment". I mean, comment's body field displays as "Comment". And what's interesting, I cannot find it in the translation list (for manual translation).


texts:
I am trying to build a custom theme in drupal.
I have two page files:

page.html.twig
page--front.html.twig

both files have the same code:

    {{ page.myheader }}

            {{ page.sitebrand }}

The Problem:
I see the blocks in all the pages except the front page.

by the way:
I did set my front page as this:

I created a simple page with 'front' alias.

Is this cousing a problem?

The question:
What am I doing wrong?
How can make different display in the front page?

full page--front.html.twig

<!DOCTYPE html>

    <title></title>

    {{ page.myheader }}

            {{ page.sitebrand }}

xxx dagfv

            <button type="button" class="btn btn-lg btn-block">
                Default
            </button>

                <button class="btn btn-default">
                    Action
                </button>
                <button data-toggle="dropdown" class="btn btn-default dropdown-toggle">

                </button>

                        Action

                        Another action

                        Something else here

                {{ page.mainmenu }}

        {{ page.content }}


texts: Javascript variable value in page source for seo from Drupal.settings

texts:
Declared a variable in settings.php

$conf['my-variable'] ="my-variable-value";

Added inline javascript

drupal_add_js("array('my-variable'=>variable_get('my-variable'))");

Need to print variable values from Drupal.setttings in inline js

drupal_add_js("jQuery(document).ready(function(){
  window.my-val = Drupal.settings.my-variable;

})",'inline');

So the output on page is comming up like

<script type="text/javascript">
window.my-val =Drupal.settings.my-variable;
</script>

But I need it should be like below for seo requirement

<script type="text/javascript">
window.my-val = "my-variable-value";
</script>


texts: How to remove the form_state, form_id and form_build_id when submitting a form?

texts:
I have been creating a payment gateway integration module for Drupal 7.

When I post the form to the payment gateway API, it is posting extra variables like form_id, form_build_id, and form_token.

Can anybody tell me a way to eliminate these extra variables?


texts: How to synchronize two check boxes values, upon change?

texts:
In my module, I have created a simple form with a single checkbox (A) and a submit button.
I also have a checkbox (B) boolean that i added in the user profile.
Now I would like to:

write a submit function that would update checkbox (B) with the status of checkbox (A).
Get rid of the submit button, and have Checkbox B updated automatically  upon change of checkbox (A) status.

I am trying to achieve an email notification on comments system as I described here in a previous post: How to add a checkbox form to a panel?

Thanks,

baba


texts: What may cause my fatal error Call to undefined function _menu_target_edit_form_extra_elements_submit()?

texts:
I'm running Drupal 7.53 and all my modules are up to date. I suddenly started having this error on my Drupal site.

  Fatal error: Call to undefined function _menu_target_edit_form_extra_elements_submit() in /home/portal/public_html/includes/form.inc on line 1520

This error happens when I try to add a new content type or edit a content type that includes a media or image field. It doesn't matter if the field is empty or contains content.  However, if I remove the field from the content type, it saves just fine.

Since my site is very event driven, I am unable to edit events until the problem is fixed.  I've run registry update, flushed caches, run cron...  you name it. I did not update any modules since it was working on Tuesday to when it stopped working this morning. I did update the media module on Tuesday but I am pretty sure I did this before I added a few events.

Any ideas?


texts: how do I theme the cart and checkout pages in Drupal commerce?  I have set content, account, billing, and payment parts. Is there any --.tpl.php file to create?


texts:
I'm working on a Druapl 8 project and I'm trying to execute a migration which serve to import content of a basic content type, the content type has a field of type Date and the associated field in my CSV source file has the format "dd-mm-yyyy", I used the 'format_date' plugin to migrate the date as bellow:

process:
  field_date:
    plugin: format_date
    from_format: 'd-m-Y'
    to_format: 'd/m/Y'
    source: Date

with field_date is the machine name of my content type date field, and Date is the field name in my csv file:
source.csv

title,Date
title 1,12-01-2017
title 2,13-03-2018

After migration the content has been created as it should but with date value as bellow:

Any help please!


texts: Is it possible to implement date field as one select list?

texts:
Currently when we use default date field with widget select list, it shows like 3 drop-downs with Year, month and date. Is there any way to make it as one drop down. I need to display few dates from today's date( may be 5 or 10 dates).

My date field should look like below section. Format can be different but will display whole date in one select list.

September 19 2014
September 20 2014
September 21 2014


texts: How to move D7 from /sites/sitename to /site/default?

texts:
I was successful at this once and now I forgot how I did it.  I'm copying a site's files from my local computer to a host GoDaddy.  What I'm doing is installing D7 at the host's control panel, updating the site to D7.29 then copying files from my local D7.29 install to the web and then importing the database.  It worked with no problems once a month ago.  Now no luck.  The best I can do is get the site to appear to be all up and running, all CSS works, can even log in and manage modules if desired, but NO pictures show up.  It's as if the folder structure is not known for those files.  The reason I believe is that I'm copying from sites/sitename (all the local site specific files) (and then fixing settings.php of course) and then since Drupal on GoDaddy only seems to want to work with /sites/default I'm copying the files to that location, default.  Like I said I did it once no problem, now not so...  Beautiful site with all CSS and content but no pix.  I've even tried this locally and it doesn't work, same problem, wondering what to fix.

Newbie
Dave N


texts: How to install drush on 1 and 1 linux hosting for creating sub-theme for ZEN?


texts: How do I display page numbers in a book?

texts: I have my nodes organized using the book module. I would like to be able to display the page number at the bottom of the page. The pages would be numbered according to the order in the book outline. Is this possible? I even tried looking for a PHP code snippet I could put in book-navigation.tpl.php or similar.


texts: Solr search api indexing referenced fields by their id not value

texts:
So i created a basic Solr core and index. In the index i added several diff. content types and added a lot of fields from those CT, including a aggregated field (union of several diff. fields: plain text, entity ref. fields, etc) Now i built a view based on that index (displaying rendered entities), and in the filter added a Fulltext search which will search on the Aggregated field.

For the most part it all works as designed, except that the fields which are entity reference fields (taxonomies) are indexed by their reference id (tid) and not the human readable value. E.g.: if a term (Math) from the vocabulary Subjects is indexed, the value which will be stored by solr is 5 (which is the term id), so when you use the fulltext search field and search Math there will be no results, but if you search 5, the content type where Math is selected will be displayed, not the best UI if you agreee.

Is there any way to search by the human readable values, without me altering the query and then finding the corresponding tid of the value entered in the search and then passing it back to the query, because that kinda defeats the purpose of having a backend search engine.

Thanks,
Will


texts:
I'm working on a module. I've added a tab to each Content Type in hook_menu using something like:

$items['admin/structure/types/manage/%/stuff'] = array(
    'title' => 'Manage stuff',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('stuff_content_type_stuff_form', 4),
    'access arguments' => array('administer content types'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 100
);

The tab appears fine when I visit admin/structure/types/manage/article/edit, for example. However, when I view admin/structure/types to view the list of content types, I'd like to see "Manage stuff" listed as a link in the "operations" column alongside "Manage fields" and "Manage display".

Is this possible? Can someone please provide a way to do this?


texts: How to have a 'Has Photo' (true or false) views filter

texts:
I am looking to list a views result set based on whether it does or does not have a photo in the photo field.  I think I remember this being part of d6? d5 maybe? Regardless, I cannot find it for d7 if it exists.

If there is no such option, thoughts on how to limit a result set based on whether the field contains a photo / file or not?

Thanks


texts:
This seems like it should be simple, but: How do I make loop true on videos uploaded with D7's video module (HTML 5 Player)? The setting is no where on the front end, and when I dive into the module's theme options, 'loop' doesn't even seem to be a variable? The only variables seem to be:

 * $item
 * $width
 * $height
 * $autoplay
 * $autobuffering

Placing loop="true" inline would be the obvious option, but this also doesn't seem to be do-able via the D7 module.


texts: Node needs save -> edit -> save to fill all fields

texts:
I have a Drupal node form with fields that depend on each other.

1 - first field (text) takes data (using default value and tokens) from other fields

2 - second field takes data from the first field (it's a geofield which geocodes from text field)

The problem is, that on hitting "save", only first field shows data. To fill second field, I need to hit "edit" and than "save" again.

Is there a way to fill both fields on one "save"?

Will appreciate any guidance.


texts:
I've inherited a Drupal 7 site that's having an issue. The field "date" appears on the test site, but not on prod, and the field "title" is linked on test, but not prod. On both sites, the "date" field shows up in views "preview."

Update: I've figured out as much as the view is scanning the wrong template file. There is a file with an identical name learning/views-view-fields--block.tpl that is being used in the view instead of news/views-view-field--block.

How does this happen and how can it be fixed (I'm new to Drupal view templates, so I apologize if there's a simple solution).


texts: Assigning entity (node) to group (og) programmatically

texts:
How to assign an entity to a group programmatically? I have referred to this question however it doesn't seems to work:

$values = array(
    'type' => 'my_type',
    'uid' => $user->uid,
    'status' => 1,
    'comment' => 1,
    'promote' => 0,
);
$entity = entity_create('node', $values);
$ewrapper = entity_metadata_wrapper('node', $entity);
$ewrapper->body->set(array('value' => $form_state['values']['body']));
$ewrapper->save();
$result = og_group('node', $form_state['values']['group_id'], ['entity type' => 'node', 'entity' => $ewrapper, 'state' => OG_STATE_ACTIVE]);
$ewrapper->save();


texts: xpath XML parser is not parsing anything, neither does give any debug info

texts:
Mappings:
https://www.evernote.com/shard/s61/sh/3e900019-a2c7-4a10-bc1c-0868341c4d9d/a735396d74047a86da8668c34c7a9f7d

Source feed:
https://www.monosnap.com/image/BmKv9p9ao4hua1wvWpRh2pl85

For some reason I can't get it to import anything. What am I missing?

Tried also context: //channel/item.

Feed path: http://poliisi.fi/poliisi/kanta-hame/home.nsf/feedrss.xml

This is very simple and basic feed which is giving me a major headache currently. Maybe a fresh pair of eyes is smarter than mine.


texts: Filter out nodes with the same title in views

texts:
I have an event system which uses the date repeat entity to clone repeating events and another section which uses the similar by terms module to create a view of events related to the article.

However I want to filter out the repeating events, is there a way of adding a condition that if the titles match then ignore them?


texts:
Please help about below error. I don't know how to resolve below error. I will try several ways follows from searches and drupal.org forums. But error still comes back.

Please check the below image everything I mentioned in that. wamp versions, windows versions.


texts: How to prevent fake drupalcommerce orders

texts:
We have a website developed using drupal commerce.All listing and details pages of products are custom made ones.Not drupal views.We have a issue with fake orders.We are getting nearly 1000 fake orders from this site.Doing nothing but only adding products to the cart.I can see that its from whole website.

We have used a hyperlink as add to cart button.Is there any problem with this?

This site is open for anonymous users.When we restrict the site only for registered users these fake orders dramatically reduce.I meant 0 fake orders.

Cant guess whats going on with this.Have installed some spam prevention drupal modules but no luck.

Any one suggest a method to prevent this.

Thanks


texts:
I'm working on a custom module that I want to hook into a custom commerce template.

Heres is the code inside of my custom module the returns the variable.

 /**
     * Implements hook_theme().
     * @param $existing
     * @param $type
     * @param $theme
     * @param $path
     * @return array
     */
    function my_theme($existing, $type, $theme, $path) {
        return [
              'commerce-product--full' => [
                'variables'=> array (
                    'key'=> "I'm a key.",
                ),
              ],
        ]
}

Inside of commerce-product--full, using kint(key), I get null as a response.

Am I missing something?


texts: We're using Feeds (https://drupal.org/project/feeds) and things are working fine. However, we use Drupal/Acquia Commons. How might we assign Organic Groups to each new node?


texts: Why am I getting the error "Unknown data property" when the field exists?

texts:
I am trying to grab all of the fields of a node (which I am doing by using array_keys). At this point, I want to feed them all to entity_metadata_wrapper(), and grab their values.

I will then, if they are strings, print them to a PDF document using TCPDF's Text() function.

Everything looks like it will work correctly; however, certain fields give an error as such:

  EntityMetadataWrapperException: Unknown data property field_grade. in
  EntityStructureWrapper->getPropertyInfo()

The field exists in my node, though.

'field_grade' =>
    array (size=13)
      'default_value' => null
      'description' => string '' (length=0)
      'display' =>
        array (size=4)

This is the code I am using.

$wrapper = entity_metadata_wrapper('node', $node);
$trip_fields = field_info_instances('node', 'trip');
$trip_fieldskeys = array_keys($trip_fields);
$margintop = 0;

foreach($trip_fieldskeys as $item) {
  $value = $wrapper->$item->value();
  if (gettype($value) == "string") {
    $pdf->Text(0, $margintop, $value, false, false, true, 0, 0,
       '', false, '', 0, false, 'T', 'M', false);
    $margintop = $margintop + 25;
  }
}


texts:
Is it possible to create a relationship based on a field?

In a field settings, I want to set the Relationship to be referencing another field. Does this make sense? I want to turn a field into a relationship.

An example: An integer field is meant to contain version id numbers. So have a relationship from the integer field to the node_revision table.


texts: How do I restore/recreate accounts created using OpenID after restoring from a backup?

texts:
After performing a rollback of our Drupal 7 site, we realized we had 20 - 30 users that were "lost".  Looking for the most efficient / possible (?) way to recreate those users with the least impact on the end user.
The users are created using the OpenIDConnect Module (openid_connect Version: 7.x-1.0-beta8).  We call out to an internal system that is functioning as the IDP.  When we rolled back, the users, which still exist in the internal system, are obviously no longer in the rolled back Drupal instance.  We have access to the list of users by email address.  As a last-ditch solution, we can email them and have them re-setup their account through the Drupal interface.
I'm wondering if anyone has come across this or a similar problem and has a more elegant solution.  Is there a way to get the data needed from the "old" Drupal 7 database for those 20 - 30 users and perhaps perform inserts directly into the "new" production Drupal instance which no longer has them?


texts: How to show one field in more than one regions?

texts: I'm using Drupal 7. I have used two column stacked layout to display Node Fields. I created one Rating Field and I showed it in top region. I want to show the same field in bottom region also. How can I show the same field in bottom region?


texts: Commerce kickstart 2 creating custom front page

texts:
I subthemed the original kickstart 2 commerce site and everything works fine. I also understand the CSS structure and how to regulate that.

What I'm trying to understand is how the frontpage works and how to change the structure. It looks like the frontpage is created of blocks so I can change what shows or doesn't show on frontpage via Site settings -> Blocks.

However, how could I add lets say a custom div with h1 heading and few paragraphs to it?

This can be easily created with adding a new basic page, where you can use full html in body and style the page to your liking. How does this work with a front page?

If I create a basic page with the paragraph "Welcome to the website" that I want to use on the front page, and then display it in a main content block, what bothers me is that it renders Read more button. Which I don't want.

Where can I do that for frontapge then?


texts: update views field value in ajax callback function from other fields

texts:
How can i update drupal views field value without reloading a page. when i execute my ajax callback function i generate some value which is getting save in db. I want to update that value in my drupal view. can anyone help.

'#ajax' => array(
            'callback' => 'ajax_approval_status_change_callback',
            'wrapper'  => 'container-inline-'.$reg_id ,
            'progress' => array( 'type' => 'none',  'message' => t('updating')),
        ),

This is my callback function. i want another wrapper to be update.


texts: Why doesn't core pass unit tests out of the box?

texts:
I’m on Travis CI, trying to diagnose some issues. In the process I found many unit tests failing. I originally though my module was causing issues, but it turn out that core fails many unit tests all on its own given my basic setup. What am I missing to get Drupal to pass:

cd ..
git clone https://git.drupalcode.org/project/drupal.git
cd drupal
git checkout 8.8.x
export COMPOSER_MEMORY_LIMIT=-1
composer update phpunit/phpunit symfony/phpunit-bridge phpspec/prophecy symfony/yaml doctrine/common doctrine/annotations --with-dependencies
vendor/bin/phpunit -c core/phpunit.xml.dist --testsuite=unit

The result is

Tests: 18995, Assertions: 33695, Errors: 33, Failures: 57, Skipped: 2543, Incomplete: 3.

When (if) I get this working, I would like to add in the Kernel tests. I’ve already been able to successfully run the database and entity layer kernel tests with MySQL.

All of the errors are related to Doctrine:

 Failed asserting that exception of type "Doctrine\Common\Annotations\AnnotationException" matches expected exception "\InvalidArgumentException". Message was: "[Semantical Error] The annotation "@Doctrine\Common\Annotations\Annotation\Enum" in property Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationEnumLiteralInvalid::$value does not exist, or could not be auto-loaded." at /home/travis/build/Beakerboy/drupal/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54


texts: about constructing a database for student multi-step form

texts: I need to construct a database for students. I am wondering how to implement the database. Do I add the students data into the users table? Do I create a student's table, and when a new student is added add part of the data of the student into the users table and the other part into the students table?


texts: Preprocessor to use a different template for popup window

texts:
I'd like to provide the ability to open some content in a new window without all of the headers and sidebars of the normal content window.  I tried to do this with a preprocessor, and got close, but still no cigar:

function THEME_preprocess_page(&$vars) {
  if (isset($_GET['popup']) && $_GET['popup'] == '1') {
    //error_log( var_export( $vars['theme_hook_suggestions'], true ) );
    // returns as last array item: page__node__3
    $vars['theme_hook_suggestions'][] = 'page__node__3__popup';
  }
}

I then have a template with the file name: page--node--3--popup.tpl.php which is just a straight copy of the region--content.tpl.php file, and it actually does hit that template!  The problem is that only the title shows up - and when I clear the cache I get a warning message that content is undefined in my popup template. I've also tried naming the file and setting the theme_hook_suggestions to 'region--content--popup'/'region_content_popup' with the same results.

Here is the content of region--content--popup.tpl.php

<div<?php print $attributes; ?>>
  <div<?php print $content_attributes; ?>>

    <?php if ($title): ?>
    <?php if ($title_hidden): ?>
<?php endif; ?>
    <?php print render($title_prefix); ?>

<?php print $title; ?>

    <?php print render($title_suffix); ?>
    <?php if ($title_hidden): ?>
<?php endif; ?>
    <?php endif; ?>
    <?php if ($tabs): ?>
<?php print render($tabs); ?>
<?php endif; ?>
    <?php if ($action_links): ?>
<?php print render($action_links); ?>
<?php endif; ?>
    <?php print $content; ?>
    <?php if ($feed_icons): ?>
<?php print $feed_icons; ?>
<?php endif; ?>

The H1 page title appears and nothing else.


texts: Removing/Restricting for wrapper by role

texts:
I want to remove the div that holds the comment wrapper from a content type. What is the best wayto do this?

I could create a module, but I think I would only hode the form and not the headers that are inside the wrapper (just outside the form).

I guess I could hold it via the template, but I'm not sure how to pull the roles.

Thanks


texts: Should I use t() in hook_update_N() or admin UI in a custom module?

texts:
Background / motivation
Many implementations of hook_update_N() and hook_install() in contrib and core modules in D7 and D8/D9 contain calls to the t() function. In general, I think it is considered a "best practice" to use t() for all kinds of strings that will be displayed to any user unknown to us.
For custom site-specific modules, I often avoid the t(), if I know that the message will never be shown to anybody outside the developers. This applies especially to hook_update_N() and hook_install(). Sometimes I use format_string() instead, to get the replacement without the translation.
My own motivation is like this:

I don't want these one-off strings to pollute the database and the translations UI. (not sure under which circumstances this would happen)
The audience of an update hook is a small team of developers and devops, who are used to code comments written in English.
I want the original English message to appear in logs, UI and CLI output, and in copy+paste snippets sent around between developers.
I want developers / site builders to always see the same string.

Personally, I sometimes even go further, and don't use t() for names of custom field formatters, plugins etc.
I have a colleague who is not convinced by my pragmatic arguments, and wants to do things "by the book". He places high value on consistency, and wants to use t() everywhere.
Perhaps one argument in favor of t() is that it would make it easier to later copy parts of the code into a contrib or in-house module, without having to modify all the strings. Not very likely for a typical hook_update_N(), but the possibility exists.
Question
Can it be "acceptable" as a team policy to not require t() for strings with an "internal" audience?
In which cases could it be acceptable to not use t()?
Is there any convention or good reason we could use to decide this, beyond personal preference?
EDIT
There are some more specific questions hiding in the original question. I am putting these in a section clearly marked as "EDIT" to not be accused of a Heisenberging.

In which cases could it be acceptable to not use t()?

Specific cases which could be discussed:

Messages returned from hook_update_N().
Exceptions which are thrown in hook_update_N() on failure. (#817160 suggests to NOT translate exception messages.)
Names of field formatters and other plugins defined in custom modules. An argument could be made that original names should not be translated.
(watchdog() / Drupal::logger() calls are mentioned in a comment, but I am less interested in those atm)

The arguments for/against apply differently to these cases.


texts: How to add Google Maps data overlay to Openlayers map?

texts:
So, for data purposes I want to use OpenLayers for my maps presentation but I want to use Google Maps as my data overlay or base layer. I know this is possible, but the UI isn't exactly friendly to new users.

As always, any advice is appreciated.


texts: How to alter a form element to include it inside a fieldset

texts:
I am using field_attach_form() to display an entity's form. When I call this function, it automatically builds the form, which does not contain any fieldsets, just ungrouped form elements.

Before the form is displayed I would like to take some of the form elements and group them into fieldsets. If I have something like this:

$form array:
    form element 1
        attributes
    form element 2
        attributes
    fieldset1
        attributes
    fieldset2
        attributes

Is there a form element attribute or special function that will allow me to tell Drupal to automatically place "form element 1" into "fieldset1"?

Alternatively, can this be done at the core/entity level, not the custom module, so that when field_attach_form() is called the fieldsets are automatically created?


texts: Modify search result (Display Suite search)

texts:
Second day and I don't see solution for my problem.
I want to modify the output of a single search result.
Yesterday, after ~8h (?) I understood that search-api-page-results.tpl.php overrides default search results page. But search-api-page-result.tpl.php doesn't overrides single search result. The same search-result.tpl.php. Also tried template_preprocess_search_result function with no response.
I know that I can modify output of result in Structure > Display Suite > Manage Display but this is not enough for what I want to do next with output.
Cache ofc cleared many times.
Thanks in advance for help.


texts:
How to get pager url in node page ,actually what i want i am creating a view block with listing of nodes with ajax in view exposed filter,because exposed filter doesnt work without ajax,the problem i am facing when i am clicking pagination of view url is not creating like /system-manager/central-ordering/?page=1 .

Also used quick tabs where i am showing view as block in tab.

What i want when user click on the node in view page to see the node content ,i am placing there back button but on clicking back button everytime its going to pager 1(/system-manager/central-ordering) ,not on the same pager from where its clicked(/system-manager/central-ordering?page=3) .

Is it possible to add pagination in view url argument with ajax?


texts:
I would like to add 4 columns/containers just above the footer of the homepage. Similar to the triptych blocks that the Bartik theme offers, except I would like to have 4 of them. I am using a Zen sub theme.

How would I go about adding 4 block and having them display one next to another?


texts: Drush 9 command equivalent to core-quick-drupal (qd)?

texts:
In Drush 8, there is a core-quick-drupal (qd) command, however, it's missing in Drush 9.

Is there any equivalent command in Drush 9 which allows to download, install and serve Drupal with minimal configuration and dependencies?


texts: Views to show all child terms without showing parent

texts:
Vocabulary has 5 parents, each containing 10 child.

Through views I want to display all child terms in a block, but to hide/skip showing parent terms in result.

Creating view that displays both parents and child was easy, but this I cant figure out.


texts:
I have working development project of Drupal 7 using PHP 5.x. I changed the PHP version to PHP 7 using nginx webserver. It does not work and I have got the following error message:

 Fatal error: Uncaught Error: Undefined class constant
 'MYSQL_ATTR_USE_BUFFERED_QUERY' in
 C:\xampp-2\htdocs\d738\includes\database\mysql\database.inc:46 Stack
 trace: #0 C:\xampp-2\htdocs\d738\includes\database\database.inc(1689):
 DatabaseConnection_mysql->__construct(Array) #1
 C:\xampp-2\htdocs\d738\includes\database\database.inc(1479):
 Database::openConnection('default', 'default') #2
 C:\xampp-2\htdocs\d738\includes\database\database.inc(2570):
 Database::getConnection() #3
 C:\xampp-2\htdocs\d738\includes\cache.inc(348):
 db_escape_table('cache_bootstrap') #4
 C:\xampp-2\htdocs\d738\includes\cache.inc(329):
 DrupalDatabaseCache->getMultiple(Array) #5
 C:\xampp-2\htdocs\d738\includes\cache.inc(56):
 DrupalDatabaseCache->get('module_implemen...') #6
 C:\xampp-2\htdocs\d738\includes\module.inc(723):
 cache_get('module_implemen...', 'cache_bootstrap') #7
 C:\xampp-2\htdocs\d738\includes\module.inc(892):
 module_implements('system_theme_in...') #8
 C:\xampp-2\htdocs\d738\modules\system\system.module(2502):
 module_invoke_all('system_theme in
 C:\xampp-2\htdocs\d738\includes\database\mysql\database.inc on line 46

This error means that Drupal 7 is using obsoleted MySQL functions and it is not support with PHP any more!

However, I don't think Drupal still uses this obsoleted PHP extension. So I have a strange error as I think!


texts:
I would like to save the form field values by using mymodule_admin(). How can I get the values saved in mymodule_admin() on the other form without using the database?

function subscription_admin() {
  $form = array();
  $form['txtSubscription'] = array(
        '#type' => 'textfield',
        '#title' => t('Enter The Subscription Amount'),
        '#default_value' => variable_get('txtSubscription', '500'),
        '#size' => 20,
        '#maxlength' => 20,
        '#description' => t('This text field tells the subscription generation amount'),
        '#required' => TRUE,
  );
return system_settings_form($form);
}

This is the admin view form. If the administrator user changes the value, it would be changed.


texts: Customizing User Profile - adding lots of extra parameters retrieved from my own database tables

texts:
I would like to customize the User Profile so that I could display very much extra parameters that the user can set - and display them for users that watch other user's profiles; but these parameters would come from my own database tables.
I have to create a dating site, where users can set their own parameters like eye color, hair color, height, etc.

I already made a class from which these data can be retrieved and set, I just have to build it in the User Profile - or I could also place it anywhere else, but I thought it would be a more comfortable way to display these among other user parameters - and even set them when the user is watching his/her own profile.

Besides, I will have to make a page where users can search for their "future partners" depending on the different parameters that the users select (for example someone looks for a user with blue eyes and blond hair, or anything else :D) - my own queries would run and search for given users.

What do you suggest? Should I make a module? Or should I override my template files? What would be a nice solution? How would You do that in Drupal 6?

I hooe I could clarify what I would like to do, if something isn't quite clear, please ask!
Thanks in advance!


texts:
I am using the display suite region to block, but the content in the region is now displaying on every page of the site and not just the node its meant to display in! Surely this isn't right? Am I missing a trick here?

This is in Drupal 8 if this helps. Thanks in advance!


texts:
I just tried to update some Modules on drupal 7 and got this:

  Update failed! See the log below for more information. Your site is still in maintenance mode.

  ckeditor

Error installing / updating
File Transfer failed, reason: Cannot remove file /home/myinvoice/public_html/sites/all/modules/ckeditor/ckeditor/plugins/dialog/dialogDefinition.js.

  imce

Error installing / updating
File Transfer failed, reason: Cannot remove file /home/myinvoice/public_html/sites/all/modules/imce/tpl/imce-file-list.tpl.php.

  menu_token

Error installing / updating
File Transfer failed, reason: Cannot remove file /home/myinvoice/public_html/sites/all/modules/menu_token/menu_token.module.

  recaptcha

Error installing / updating
File Transfer failed, reason: Cannot remove file /home/myinvoice/public_html/sites/all/modules/recaptcha/recaptcha.install.

  Next steps

Your modules have been downloaded and updated. - DOES THIS MEAN THAT IT DID IN FACT WORK???
Run database updates


texts: Using ImageStyle with dependency injection

texts:
Is there a way to use the ImageStyle class with dependency injection instead of a static call?

I am struggling to find an example.

At the moment I have a block which is importing the class with

use Drupal\image\Entity\ImageStyle;

And then calls the load method with

ImageStyle::load('machine_name')->buildUrl($path);

But I am wondering if there's a better way to do this?


texts: Make flippy pager appear in full content view

texts: I love the simplicity of the Flippy pager, and it works exactly as advertised until I display the node it's supposed to appear on in a view. Basically, I want the latest node of a specific content type to appear as the front page. Okay, I can use a view with the full content style and number of results set to 1. That works, but the pager (generated by Flippy) is missing. This is a webcomic site, so it is critical that the pager appear. Is there any way to make the pager appear exactly as it does if I navigate to the actual node?


texts: cannot see tabs for manage fields etc with administrative toolbars add content bar

texts:
This must be something new because never seen it before now. There is a grey bar with the add content find content and edit shortcuts links on it which completely obscure the tabs for manage field etc in content types.

How can I keep the administration toolbar but remove that grey bar? AND WHY would anyone want it placed in such a way as to block out important regularly used tabs?


texts: Combine photos from parent node and referenced nodes into a single list (for slideshow)

texts:
Drupal 8
I have two content types. Department and Employee.
Department has an entity reference field that references Employee(s).
Department and Employee both have a field called “field_photos”. (Same field name in both).
In views (or via Twig in a node template), I’d like to display all “field photos” from both the Department Node AND Employee(s) nodes referenced by that Department… into a single list output.
So the end output will be a slideshow for each department showing all “field_photos” from that Department and referenced Employees.


texts: how to render a node field of a referenced node on the node form

texts: I'm using Display Suite to show a referenced node inside another node in the default display. But when I edit this node that has the entity reference field on it, it shows me the reference field and I'd like that to show the rendered content of a field of the referenced node. Is there a way in Display Suite or do I have to write some code in a tpl file somewhere?


texts: How can I enable JavaScript form validation for AJAX submit buttons?

texts: Drupal 8 comes with client-side JavaScript form validation; however, for a submit button with #ajax, it is disabled. How can I enable it?


texts: Edit the classess applied to a field from outside the field template

texts:
I am creating my own Panels Style Plugins.

The styles are applied to a Panel Pane which contains a field.

From the Style, I can add a wrapper DIV to modify the display of the field.

However, I would like to be able to modify the actual class on the field itself (this would negate the need for a wrapper DIV).

In my field.tpl.php file I have placed a PHP variable for the class, but I'm not sure how I can access and modify this variable from outside the field.tpl.php file. Could some one give me some pointers.

Thanks!


texts: Use custom HTML file for page created by Views?

texts: I use Views to create new content and a new page for the content, but how am I supposed to customize the HTML layout of the page? I can style elements of the page via CSS, but what if I wanted to have my own CSS3 (animated sprite) elements? For example, most CSS3 sprites require you to have divs contained in a specific manner, but those divs are not present in a Views created page and I see no viable way to manually add them? How would I go about doing this?


texts: Print field from reference of reference (node)

texts:
I use the module "entity reference" and I ave "Inline Entity Form" in the node. The first reference has another reference inside. In total there are 3 nests, a grandfather, a father and son.
In node.tpl the first parent node how can I print a field of his nephew?

- Node.1
-- Ref. Node.2
--- Ref. Node.3

I want to print a Node.3 field's in Node.1

Thanks so much!


texts: How to add revisions tab to a custom content entity and list revisions?

texts:
I've just created/generated a custom content entity module using Drush. I've checked I would like to use revisions, but I cannot see its tab.
How can I add the revisions tab to this custom content entity and list its revisions?


texts: How to create a link in my view of users to perform an operation like Active or Block?

texts:
I am using Views to create a view for user management, which looks like in the image below:

How to create an "Active" or "Block" link in my view which performs an operation for the selected user like so:

When I click on "Active" in the Operations column, then the user should be active.
When I click on "Block" in the Operations column, then the user should be blocked.

Note: Views Bulk Operations (VBO) is not working. Refer to the image below. When l select all users in my view results and select "Block current user" as theoperation, then the users are not blocked. I have unstalled the VBO module and re-installed it again. And I also gave permission "user block" to that role. But nothing solved my issue.


texts: load shipping custom field value by entity_metawrapper

texts:
I add some field to shipping and billing information, in payment stage of checkout I want load order billing information,I know I can load it by

  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $billing_info = $order_wrapper->commerce_customer_billing->commerce_customer_address->value();
  $shipping_info = $order_wrapper->commerce_customer_shipping->commerce_customer_address->value();

when I goto en/admin/commerce/customer-profiles/414  I see my filled up information,but when I try to dpm them in code(my custom payment gatway)  it did not load my custom field values. is it the bug of  entity_metadata_wrapper or I did some mistakes?
and finally how can I load my custom field correctly?

Update

I use below method to get my fields and work

    $profile_id=$order->commerce_customer_billing['und'][0]['profile_id'];
      $profile = commerce_customer_profile_load($profile_id);
      //dpm($profile);
  $billing_info['thoroughfare']=$profile->field_full_address['und'][0]['value'];

but really want to know  entity_meta_data_wrapper can't load them and it is a bug on it or if can what is the solution?


texts:
I need help on this code which is invoked on calculate sell price rules event
on cart view. Line items and order are properly modified. But nothing is displayed, old unit price amount and old total amount are displayed. Even after cart refresh. Any idea ?

/**
* Calculates the price when line item are dispalyed
* or created.
*/

function mymodule_calculate_product_price_cart($order) {
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    // Iterates on line items and alter the price.
    $commerce_line_items = array();
    foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
      $line_item = $line_item_wrapper->value();
      $type = $line_item_wrapper->commerce_product->value()->type;
      if ($type === 'insurance') {
        $package_price   = $line_item_wrapper->commerce_product->field_package_ref->commerce_price->amount->value();
        $warranty_price  = $line_item_wrapper->commerce_product->commerce_price->amount->value();
        $amount = _mymodule_calculate_policy_price($warranty_price, $package_price);
      }
      elseif ($type === 'little_product') {
        $amount = $line_item_wrapper->commerce_product->commerce_price->amount->value();
      }
      else {
        $commerce_line_items[$delta] = $line_item;
        continue;
      }
      $qty = $line_item->quantity;
      // This sets the unit price by adding a component price 'base_price'
      mymodule_line_item_price_amount($line_item, $amount, 'commerce_unit_price');
      mymodule_line_item_price_amount($line_item, $qty * $amount, 'commerce_total');
      commerce_line_item_save($line_item);
      entity_get_controller('commerce_line_item')->resetCache(array($line_item->line_item_id));
      $commerce_line_items[$delta] = $line_item;
    }
    $order_wrapper->commerce_line_items = $commerce_line_items;
    module_invoke_all('commerce_cart_order_refresh', $order_wrapper);
    commerce_order_save($order_wrapper->value());
  }


texts: Why node export:import link is not displayed?

texts:
I want to export drupal 7 nodes with node export. I have downloaded and enabled the node export module. The node export option has been added in the content tabs next to view,edit,translate.
I exporte the nodes in a file however I cannot find the import link in order to import them!
Is there something else to configure?


texts:
For example, How can I add some classes or hide labels and instead of it add placeholder with using of ThemeName_preprocess_comment to 'subject' and 'name' comments form elements?

I have tried to usedrupal_set_message(kint($variables)); in ThemeName_preprocess_comment section, but it cause the empty screen erroe in my site.

So how can I add some classes to default (or my own created) comments elements so I can target them for adding CSS style.

How can I target default comments form element in CSS?


texts: Retrieving customer information to use in drupal commerce payment module

texts:
I'm new to drupal development and am programming a payment module for the new drupal commerce module.  It's will be a basic api module that allows the user to stay on the site and makes a separate curl call to send the data and use the response to indicate success or failure.

I copied the authorize.net aim payment module and have so far gotten to a point where I'm correctly posting the information that's being sent using the authorize module.  However the payment system I'm using requires the customer name and billing address and I'm not sure about how to go about gathering that information.  I know in the order there is a user/customer profile id but I don't know how to get any other information about the customer.  I do know that the billing address is gathered, it just isn't sent to authorize.


texts: Install module that has an external php script and a couple of other files

texts:
i want to develop a module that has some pdf modelling functionality. I have an external script I want to use and some javascript.
i wonder what is the best solution to get a module working from the drupal install routine.

1.) Do i have to add my external script to the drupal library...and remove it when my module is deinstalled?
2.) Can you recommend some good tutorials to get started with install scripts?

Any hints are welcome...

Thanks


texts: Send a mail from my custom module after custom form submit by user

texts:
I have made a custom form from a custom module. I need to send an email to the admin when user clicks submit. How can I achieve this. Can I use entities here? Say like send mail to [site:mail] or something like that. Also, its pretty odd to see that Rules module does provide an event for this.

Here's my .module file:

<?php

global $user;

function my_module_help($path, $arg) {
  switch ($path) {
    case "admin/help#formtest":
      return '<p>' . t("Test form for accept challenge") . '</p>';
      break;
  }
}

function my_module_menu() {
  $items = array();
  $items['my_module/form'] = array(
    'title' => t('My form'),
    'page callback' => 'my_module_form',
    'access arguments' => array('access content'),
    'description' => t('My form'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function my_module_form() {

 return drupal_get_form('my_module_my_form');

}

function my_module_my_form($form_state) {

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Accept Challenge',
    '#submit' => array('my_module_action'),
    );

  return $form;
}

function my_module_action($form, &$form_state) {
  drupal_set_message(t('Challenge Accepted'));
  $query = db_insert('challenges')
    ->fields(array(
    'cid' => '$node->nid',
    'uid' => '$user->uid'
    ))
    ->execute();
}

As you may have noticed there's no text field, well that is by purpose. So any suggestions would be really appreciated. One more thing, drupal_mail, or any other, say for example, mail chimp, notify etc would be of interest. What I need is just a mail to be send to admin after submit from the code itself.

Thanks


texts: Bootstrap: Responsive tables with WYSIWYG text format

texts:
I use WYSIWYG  as text format and inserted tables under the filed using MYSIWYG are not responsive and make the site unresponsive.

It looks really bad in mobile phones.

Website without table:

Website with table:

Things I tried so far and didn't work:

Zurb responsive tables
Responsive Tables Filter
Responsive Tables
After adding table with WYSIWYG I changed the text format to Full HTML and didn't work


texts: Exposed filters and taxonomy. How to make a redirect to a term page when exposed form submit?

texts:
Let's say there are 2 vocabularies:

Sizes (S, M, L, XL)
Colors (Red, Green, Yellow)

pathauto sizes: /size/s, /size/m, ... pathauto colors: /color/red, /color/green, ...

There is a catalog - taxonomy/term/% view with the following filters:

Size
Color

If we use a filter, then the url will be like this - ?field_size_tid=2&field_color_tid=3 It's normal, when several fields are selected in the filter

But when one field is selected in the filter, the url will be like -
?field_color_tid=2 But in fact the ?field_color_tid=2 = /color/green

How to make an redirect to /color/green instead of ?field_color_tid=2 in this case after exposed form submit?


texts: How to investigate (and get control over) the execution order of 3 Rules working on the same action?

texts:
I have three Rules to do something after saving content. I need to know which one is executed first and how I can control this order?

Is there a certain answer for this question?


texts: How can you check / validate the country in the Address Field + Commerce using the user's IP address?

texts:
We've got a UK based Drupal Commerce store and we'd like to:

Preselect the Address Field country, based on the user's IP
address
Not let the user continue unless the country they've selected matches the country of the their IP address

The main reason we need this check is because we're using Commerce EU VAT and the VAT Number modules, and would like to make sure that if the VAT Number is entered, the user is in the country that they say they are, as the system will apply their VAT rate based on location.

I've noticed there are quite a few IP address / location modules available, and the best I could see was Smart IP, which integrates with Rules, but I can't find a way of adding the above checking / validation to my checkout process. Any help or advice appreciated.


texts: How to list all nodes attached to a vocabulary?

texts:
I have a custom vocabulary called "healthcare_terms" that has enabled terms attached to a custom content type called "health_posts".

I just want to find all nodes that are tagged with enabled terms from "healthcare_terms"

I tried the following but it does not seem to be working.

   $query = \Drupal::entityQuery('node')
      ->condition('type', 'health_posts')
      ->condition('status', 1)
      ->condition('field_tags.entity.name', 'healthcare_terms');
    $ids = $query->execute();

Clearly I am lost. Any help or tips?

Thanks guys


texts: How to add back button for specific content?

texts:
Just realised all my pages are now displaying a back button with this code I added to node.tpl.php <FORM><INPUT Type="button" VALUE="Back" onClick="history.go(-1);return true;"></FORM>

Is there a way to change the code to include only some node content types?


texts: What to do with hidden files in Drupal 8 minor core upgrade?

texts:
Step 3 of https://api.drupal.org/api/drupal/core!UPGRADE.txt/8 says

  Also remove all of the files in the top-level directory, except any that you added manually.

it doesn't exclude or include hidden files explicitly, so my logic would say 'all' includes hidden files.

later it says

cp -R drupal-x.y.z/* drupal-x.y.z/.htaccess /path/to/your/installation

which does not copy any hidden files except .htaccess.

This would suggest not to delete the old hidden top level files. On the other hand the new version/patch of Drupal 8.y.z comes with (new?) hidden files.

So my question is: what is the correct way to handle top level hidden files other than .htaccess while upgrading Drupal 8?


texts: Drupal bootstrap running from command line

texts:
I am using Drupal 7 functions externally, and I followed this tutorial for using Drupal functions externally; it works perfectly.

In test.php file I have loaded/included Drupal bootstrap.

When I run the script from command line (php test.php), it gives me the following error:

  PDOException: SQLSTATE[42000] [1049] Unknown database 'default_drupal' in lock_may_be_available() (line 167 of /data/var/www/html/mcsu_sites_test01/includes/lock.inc).

How can I fix this error?


texts:
I'm trying to add a PHP field to a view, but I cannot see how to activate it. Do I need a module?

I'm already using / viewing:

Global: View result counter
Global: Math expression (Math expression)
Global: Custom text (Custom text)

I'd like to know how I could add:

Global: PHP field

I think it exists because of Global:PHP field with SQL in output code.


texts: Help with SQL-query finding and updating uid's from non-existing users in comment table

texts:
I need help to make a SELECT from the drupal database.

Two or three tables

comment
users
node (maybe)

I want to find all uid's in the comment table from former users but where the uid>0 in the comment table. uid's for former users but whom don't exist in the users table.

I also would like to make an UPDATE-script that can set all uid's from non-existing users in the comment table to zero "0".

This will solve some of the search indexing problem, where it stopps at certain nodes.

Please help me.


texts:
after enabling raydash module the message appear
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unsigned NOT NULL COMMENT 'The session id foreign key',tokenVARCHAR(32) NOT' at line 4: CREATE TABLE {raydash_stream} (nidINT unsigned NOT NULL auto_increment COMMENT 'The table for the stream',entity_idINT unsigned NOT NULL auto_increment COMMENT 'The entity in the video stream that\ncoresponds to the token',session_idVARCHAR(128) unsigned NOT NULL COMMENT 'The session id foreign key',tokenVARCHAR(32) NOT NULL,connected_tokenVARCHAR(32) NOT NULL COMMENT 'The token this video-stream is connected', PRIMARY KEY (nid,entity_id,session_id) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'The table stores video stream'; Array ( ) in db_create_table() (line 2684 of C:\xampp\htdocs\drupal\includes\database\database.inc).
How to fix it?


texts: I've got `PDOException: SQLSTATE[HY000] [2002] No such file or directory` when using drush

texts:
I installed Drush for the first time (so it may be a configuration error) and I'm trying to update to the latest core version of Drupal.

Drush is giving me this error - I'm on an OSX box.

dev5:clientnamedirectory my.name$ drush pm-update projects drupal-7.25

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000] [2002] No such file or directory in drupal_get_installed_schema_version() (line 155 of /Users/my.name/Sites/proface/includes/install.inc).

Additional

PDOException: SQLSTATE[HY000] [2002] No such file or directory in system_list() (line 165 of /Users/my.name/Sites/clientnamedirectory/includes/module.inc).

Drush command terminated abnormally due to an unrecoverable error.


texts: Drush pm-updatestatus No JSON output on success

texts:
My sites are running Drupal 7, Drush 8.0.3.

I'm creating a dashboard to check what core and module versions my Drupal sites are running (they're all on the same server). I use a shell script to get Drush to check available updates, write them to a JSON file then my dashboard script reads the JSON file.

/usr/local/bin/drush --root=/home/www/html/www.mysite.com rf
/usr/local/bin/drush --root=/home/www/html/www.mysite.com ups --security-only --format=json > /home/www/html-private/mysite.json

This works fine but the problem I have is that when there are no updates available I get an empty JSON file. How can I tell the difference between this and a failure to write the JSON properly? Can I get it to output 'No updates available' or something so I can tell it ran correctly?


texts: How to get jquery switchClass working in Drupal 7

texts:
I want to use the jquery "switchClass" in a Drupal 7 Website. I already got the jquery accordion and tabs working, by adding the library in this way:

drupal_add_library('system', 'ui.tabs');

drupal_add_library('system', 'ui.accordion');

Now i'm trying to get switchClass working this way:

drupal_add_library('system', 'ui.switchClass');

... which is not working.

What am i doing wrong?

Thank you for helping!

Lars


texts: Webform mail sending is successful but message says otherwise

texts:
I have this webform for contact. The site uses phpmailer 7.x-3.x-dev and library 5.2.9.

When the webform is submitted, I get the error :

  Unable to send e-mail. Contact the site administrator if the problem
  persists

and dblog says

  Sender: info@example.com Recipient:

but I get the message anyway. How come does this happen?


texts: How to do a db api join on "has no value"?

texts:
I've got two tables, Foo and Bar.  Foo and Bar can be joined by matching Foo's "nid" column to  Bar's "col" column.  In use, some rows in Foo will have a corresponding entry in Bar, but some won't.  I now want to get all the rows in Foo that do NOT have a related entry in Bar.

I'm trying something like this:

$the_query = db_select('foo', 'f');
$the_query->fields('f', array('nid', 'val'));
$the_query->join('bar', 'b', 'f.nid = b.col');
$the_query->isNull('b.col');
$the_query->execute()...

but it's not returning anything; my method of testing for null-ness is almost certainly wrong.  I've never been good at these kinds of queries, let alone being able to figure out how to do it within the context of the DB api.  Any clues out there?  Thanks!


texts: How to submit a form clicking on a checkbox?

texts:
I have a form with checkboxes.

And I need to submit the form clicking on a checkbox.

Could you clarify me, how can I do it ?

Is it possible to do it using Drupal Form API only, without Ajax Framework or Javascript/JQuery ?


texts: How to select files from /sites/default/files with IMCE filebrowser?

texts:
Somehow the settings of directories in the configuration of IMCE (7.x-1.7) is pointing to <root>/. which lets met start in the private_files directory but not in the (public) files directory.

I couldn't figure it out where to change this. I tried to set a path to the public files directory with <root>/.. but Drupal would not allow me.

The settings under Home>Administration>Configuration>Media is set  to:
Public file system path:  sites/default/files
Private file system patch: sites/default/files/private_files

Anybody having a clue ?


texts: How to use/show different path alias of same URL according to user roles?

texts:
Hi I have set URL alias of for node add from path like below :

  node/add/my_content_type =  addlink
  node/add/my_content_type  = suggestion

When user is logged-in we make access of node add form via this URL:

  www.example.com/addlink

Now for not logged-in user we want users to use node add from via below URL:

  www.example.com/suggestion

I am trying with rules on event "Initialize drupal" then checking path and roles and trying to redirect but not able to achieve that.

Please suggest is that possible to make it happen in some way!

Thanks!


texts: Is it currently possible to have Views respect RSS Display settings on a Content Type?

texts:
I have enabled and configured a 'Custom Display Setting' under 'Manage Display' of a content type for RSS

 admin/structure/types/manage/{my-type}/display/rss

I can't seem to find a way for Views to respect this new Display Setting.  The only available options for "Feed: Row style options" under a Feed View are:

Full text
Title plus teaser
Title only
Use Default RSS settings

None of which follow the Display options I specified for in the Content Type for RSS

Is there not currently a way to do this in D7? Does it require another module?

Thanks in advance.


texts: Count total number of values in a field of all nodes combined for a view

texts:
I need to count the number of entries made to a field in all nodes combined together.

I tried toggling aggregation to 'yes' and aggregation type to 'COUNT as distinct'. But at that time I'm getting count for each node separately.
But What I really need is a single line output saying this much of entries made to this field for the whole nodes combined together.

The after that I will be able to filter it by 'id from logged in user' or 'date created'.


texts: Can Drupal nodes and taxonmy be used to store "data" rather than "content"?

texts:
I'm very new to Drupal so please excuse the noobishness of this question.

After combing through the documentation and considering the flexibility of Drupal (Version 7) in defining it's own content, I find myself asking where the lines between content and data are drawn.  Some insight and advice on the limitations of things like nodes, content types and taxonomy would be appreciated.

Here's a basic overview of what I'm looking to accomplish at this stage:

I need to setup a website that will be able to keep track of a community of users that are segregated into clubs;
Clubs will be able to offer courses to their members;
Club members will be able to apply to take said courses;
A history of courses a user has taken will be recorded;
This information will be used to create reports by the administration.

My first instinct is to create separate tables for this information and handle all this through modules (WordPress being my previously relatable experience).  With that said, I find myself pondering the idea if these things could be handled through nodes, content types and taxonomy.

Would this, or some variant thereof, be a valid use of Drupals mechanisms or would this basically be the hack & slash approach that I'll end up lamenting down the road?


texts: Render/display Panel's page outside 'content'

texts:
I'm fairly new with Panels. By default Panels content will be displayed inside

 <?php print render($page['content']); ?>

Is it possible to display it outside the content?
For example if I made another placeholder and display inside it?

 <?php print render($page['content_panel']); ?>

NOTE: I'm using Drupal 7.

The reason I want to do this because the
 <?php print render($page['content']); ?>
is sitting inside

<div class="container content-main">
  <?php print render($page['content']); ?>
</div>

All contents/pages will be displayed inside content-main except 1 page which I don't want it to be inside the content-main div.

The content-main class have css which I don't need it in the panel.

The 1 page I want it to have its own <?php print render($page['content_panel']); ?> so that I can assign the panel to it and located outside the content-main div.


texts: What's a good access module for a state-level organization?

texts: I'm setting up a new website for the Maine Grand Chapter of the Order of the Eastern Star. My goal is to allow each chapter to access their own chapter's node (and nobody else's) and modify the content (annual updates to officers, calendars, etc.) and hopefully also to maintain a group calendar (modules for this yet to be chosen). So, my question at the moment is what the best node access module to use for this purpose is. I'm using D7.20. Flexi access looks interesting, but there are so many to choose from...


texts:
I create a module and implement hook_menu():

function mymodule_menu(){
  $items['mymodule/list']=array(/*...*/);
  return $items;
}

then I create a theme and create page.tpl.php and page--mymodule-list.tpl.php at the same directory.

now I can access http://localhost/?q=mymodule/list, but it use page.tpl.php to render the page, instead of page--mymodule-list.tpl.php.

How should I do to make it render the page with page--mymodule-list.tpl.php?


texts:
I have two potential workflows in mind for website content:

"Regular" Content

Write Article (Draft)
Content/Style Review
Publish Content

"Sensitive" Content

Write Article (Draft)
Compliance review
Content/Style Review
Publish Content

I'm trying to come with some way to direct the content to one of the two workflows.

In my system, if something has a certain taxonomy, it needs to go into the "sensitive" queue. If not, It can go through the normal queue.

It SEEMS like the default workflow is just set up to go A>B>C and I don't see where I can configure any logic. Thoughts?

Great Tutorial Here: https://www.youtube.com/watch?v=Mh9qQdq4sp8


texts: Convert links in content to internal form?

texts:
If I create a hyperlink inside a text field (such as node body) with an internal path uri such as "node/1234" or "index.php?q=taxonomy/term/5678", then I can use an input filter such as pathologic to convert that uri at display-time to the preferred alias uri, such as "http://example.dev/path/to/my/content"

(I would consider this a more resilient way of storing content than using the full aliased uri)

However, I can't see an easy way for a non-technical user to find an internal path uri and paste it in.
Is there any way to get drupal to spot when a user has inserted an alias-based link into the content, and convert it into an internal path uri before saving to the database? I know the menu module does this with links, using drupal_get_normal_path(), but can it be done for html links in the content? Ideally with an existing D7 module?

For example, content like

More info at this link

would be converted to

More info at this link

before saving into storage.

Also, is there any existing online discussion about the advisability of this approach?


texts: Want to add tabs from /user/* pages to other pages

texts:
When I go to any "user" pages on my site in /users/* I have menu tabs for the various pages in that section, like below.

I want to add the top level of tabs to another set of pages. Specifically, I am trying to setup the Private Msg module, which has everything in /messages/* When someone is reading their messages, I want to have the same top level of tabs they see in /users/*


texts: Installed Drupal 8 in English, added Hebrew, deleted English and now site is malfunctioning

texts:
I've deleted the English language from the site (testing purposes - long story) and now when I go to certain pages I get 404 errors (even in the page that will allow me to bring it back - admin/config/regional/language/add.

I guess adding & enabling the language with Drush-master could be helpful but I didn't find any such commands at drushcommands.com

I also tried the following Drupal 7 drush command variations (and others). None worked:

drush dl drush_english
drush dl drush_English
drush dl drush_en

Maybe there is a manual way to do so which isn't by the UI or Drush?

Ideas?


texts:
Is there a way to have two aliases to a user's profile page?

We are currently using the user paths setting at admin/build/path/pathauto - but we would like to have another path set up for the same page if that is possible.

Currently we have one path set to be:
users/[content-profile-directory-preferred_first_name-raw]-[content-profile-directory-lastname-raw]

We would like to setup a second path to the same user's profile page that would be just:
users/[user-raw]

Thanks,
Greg


texts:
According to the last paragraph:

https://api.drupal.org/api/drupal/includes%21menu.inc/group/menu/7

  Everything described so far is stored in the menu_router table. The
  menu_links table holds the visible menu links. By default these are
  derived from the same hook_menu definitions, however you are free to
  add more with menu_link_save()

I need to do the reverse of that, which API do I use? I need to add a record to the routing table but not couple that to an visible menu link...

The only way I can think (short of manually INSERT'ing) is to initialize a hook_menu call somehow with the various paths I want and call menu_rebuild()??? This appears to be how Panels does it...

Suggestions, opinions, etc???

EDIT | Why isn't this code working...resulting in "The requested page "/test" could not be found."

function test() {
  return 'Do something';
}

function pagegrid_menu_hook() {
  $items = array();

  $items['test'] = array(
    'type' => MENU_CALLBACK,

    'title' => 'TEST',

    'page callback' => 'test',
    'access arguments' => array('access content')
  );

  return $items;
}


texts: print.module error - Warning: file_put_contents

texts:
I am using the print.module and dompdf to convert the PDF files. I am getting the following warning on my pages. How would I go about fixing this?

  Warning:
  file_put_contents(/home/mysite/public_html/sites/all/modules/print/lib/dompdf/lib/fonts/php_Times-Bold.afm): failed to open stream: Permission denied in Cpdf->openFont() (line 2354 of /home/mysite/public_html/sites/all/modules/print/lib/dompdf/lib/class.pdf.php).

  Notice: Constant DOMPDF_TEMP_DIR already defined in require_once() (line 73 of /home/mysite/public_html/sites/all/modules/print/lib/dompdf/dompdf_config.inc.php).

  Notice: Constant DOMPDF_ENABLE_PHP already defined in require_once() (line 185 of /home/mysite/public_html/sites/all/modules/print/lib/dompdf/dompdf_config.inc.php).

  Notice: Constant DOMPDF_ENABLE_REMOTE already defined in require_once() (line 196 of /home/mysite/public_html/sites/all/modules/print/lib/dompdf/dompdf_config.inc.php).


texts: Image can't be removed from widget after validation using entity validation api

texts:
I have created new media type(movie image). In that media type, I have two fields image and boolean field,
I have referenced the movie image in content type and set upload limit of images to 10 and set the form-display to media-library.
I have a requirement where the user can upload multiple images and select one image as the cover image. I have used entity validation API and created my own constraint and constraint validation.
The validation is working fine if the user marks more than one cover image, but after the error is set I can't remove the image from the widget.
I'm getting these errors
Undefined index: removed_item_id in Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::updateWidget()

Error: Call to a member function label() on null in Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::updateWidget()

Thank you


texts:
i am trying to fetch loged in users photo to make a welcome block. i have applied a code which is not working

$userphoto = $user->picture;

so what to do to fetching user photo or image URL, any idea?


texts: Practical solution to get an overview of input formats in use

texts:
I'd like to clean up unused text formats on some D7 sites. So I need to know which formats are not used. I tried using VBO for this, but there is no field Content: Text format I can add there.

What's a good way to get an overview of formats in use? I'd be ok with using drush for this and I can settle with just knowing the nodes and blocks that use a specific format (ignoring other places like views headers).

I'm not looking for a generic answer like "it's stored in these and these database tables". I'm looking for a practical solution that I can use on many Drupal sites.


texts: hook_menu_local_tasks() works for the top level tabs, but the secondary tabs don't seem to have an equivalent. Does anyone know how I can modify those?


texts: add custom markup on a specific element/filter in a exposed filter (views)

texts:
I'm trying to learn how I can add or modify a markup for a specific filter on my exposed filter. I'm currently rendering the exposed filter using a block it has a lot of Drupal Generated Markup.

So far I've managed to identify the ID of the form, have been researching throughout the day for some examples but so far haven't had any progress

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

    print_r($form_id);
}

Let say for example I have to add a label with a class and a custom class on the select element and wrap it with a div. Is there a way to build or construct that modified markup?


texts: How to get product name by id from commerce order?

texts: How to get product name by id? I want send mail with product name to customer after confirm commerce order.


texts:
My articles have a field called co-author who is a relationship to other content type. Then I need to make a view (block), that when seeing an article this block show a list of other articles that have the same field (co-author). I think that is done by the contextual filters but so far I could not.

EDIT:

I have:

Content type: Article
Fields:
 - Title
 - Body
 - co-author (reference entity to co-author content type).
 - .....

Content type: Co-Author
Fields:
 - Name
 - Image
 - .....

All content:

NID   Title              co-author   ....
 1     Dummy content A    Foo (3)    ....
 2     Dummy content B    Bar (4)    ....
 5     Dummy content C    Foo (3)    ....
 6     Dummy content D    Foo (3)    ....

Then I need when I visit "Dummy content A" the block show me the following list:

- Dummy content C
- Dummy content D


texts: How to override 'views-slideshow-pager-fields.tpl.php'?

texts:
I'm taking over one of my co-workers project (i'm new to Drupal...).

I was able to override other view templates such as 'views-view--[my content type].tpl.php', 'views-view-fields--[my content type.tpl.php', but I wasn't able to override 'views-slideshow-pager-fields.tpl.php'.

What naming convention should I use to override the file?


texts: How to change date_popup date format in form?

texts:
I am working on configuration page for the custom module, using datepicker with date module.

When i set #date_format to 'd-m-Y' its ok, i need a day-month-year format but when i submit form and trying to get variable from variable_get(), i see only year-month-day format,

GOAL: i need this variable to show up as default value or maybe placeholder in proper date format ('d-m-Y'),

minor goal: also i want this datepicker not showing up "today" but i need date position in calendar to stick on variable from variable_get(). Thanks!

function mymodule_admin($form, &$form_state) {

$form['mymodule_start_date'] = array(
    '#type' => 'date_popup',
    '#title' => t('Start date'),
    '#date_format' => 'd-m-Y',
    '#attributes' => array('placeholder' => variable_get('mymodule_start_date'),
    '#datepicker_options' => array('maxDate' => 0),
    '#date_year_range' => '-3:+0',
    '#date_label_position' => 'above',
    '#theme_wrappers' => array('date_popup'),
    '#required' => TRUE,
);

return system_settings_form($form);

};

EDIT: my resource datepicker API


texts: Alter the path of the more link from Views

texts:
In Drupal 8 how do I alter the more link?

I need to give it a path which is based on a taxonomy id that is based on the current path (where the view is on) which has the taxonomy name in the path.

The current page also has a field which has this taxonomy name as a result. (but changes per page)

--

I'm trying to retrieve the taxonomy ID based on the taxonomy that is placed on the node and give the id to the more link

I am not sure if this is clear. But I have a views page with filters. And the taxonomies are the filters. Certain pages (theme pages) have their own taxonomy directed to it with a views block. The more link of that block links to the views page, I want the link to automatically check the filters of the taxonomy that is being used on these theme pages.


texts: CSS, Omega theme - how to make a  use 2 or 3 grids depending on screen with?

texts:
This question applies to Omega theme, but I think it is general to any responsive grid based theme.

Is there a method to make a <li> occupy either 2 or 3 grids, depending on screen width?

In other words, when the body tag has class responsive-layout-wide then the <li> should occupy 3 grids (as if it had omega class grid-3) and when the body has class responsive-layout-normal it should occupy 2 grids (as if it had omega class grid-2). (The body class is determined using media queries by Omega theme)

Currently the HTML looks like this:

<li class="mydiv grid-2-normal grid-3-wide"> </li>

At design time I don't know the screen width, so I applied both possible classes. So currently, despite of the screen width, the <li> width is always 3 grids because grid-3 is added last. Does Omega have any tools to make it dynamic?

The origin of this question lays here: http://drupal.org/node/1571938, unfortunately it is not explained to the end. The Views Columns Class module says:

  So you can apply alpha to the 1st, 5th, 9th blocks and omega to the
  4th, 8th, 12th blocks but also apply alpha-mobile to the 1st, 3rd, 5th
  blocks and omega-mobile on the 2nd, 4th, 6th blocks. This gives the
  freedom to the theme to apply the styles that would render a display
  of 2 columns for smaller screen resolutions and 4 columns for larger
  screen resolutions.

So, I will end up having multiple styles for a <li> (like e.g. grid-2-normal and grid-3-wide) and my theme is supposed to react to screen width and intelligently apply appropriate style to change the <li> width. Width measured in grids (columns), not in pixels. But how this can be achieved, how to render a display of 2 columns for smaller screen resolutions and 4 columns for larger screen resolutions? Where "display" means a view display, not the whole page layout (that's what I think)


texts: Referencing both a node and user in the same field

texts:
In Drupal 7, I am looking to create a field in a content type that can either reference another specific content type and/or also reference a user.  I am creating the content type programmatically in the .install file and am looking to be able to reference both types in the same field.

It currently works with one or the other as:

  'field_sport_team_members' => array(
    'field_name' => 'field_sport_team_members',
    'label' => 'Team Members',
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    'type' => 'node_reference',
    'description' => 'The members of the team',
    'weight' => '3.5',
    'required' => 0,
    'settings' => array(
      'referenceable_types' => array('club_person'),
    ),
  ),

for the reference to the content type and

'field_club_person_user' => array(
  'field_name' => 'field_sport_team_members',
  'type' => 'user_reference',
  'label' => 'Team Members',
  'description' => 'If this entry corresponds to a user, you can select the user here.',
  'weight' => '3',
  'cardinality' => FIELD_CARDINALITY_UNLIMITED,
  'translatable' => TRUE,
  'locked' => FALSE,
  'settings' => array(
  'referenceable_roles'  => array (
    4 => '4', //captain
    5 => '5', //player
   ),
   'referenceable_status' => array(
     1 => '1',
     0 => 0,
    ),
   ),
  ),

for the reference to the user type.

I guess my real question is now with the advent of "entities", is it possible to make a entity reference, but also to specify which content types to search for as well?


texts: How to organize the features export modules

texts:
As we go along with features export, its being a mess. What I have been doing so far is every module which have another module that contains the feature exports. Let say their is module 'test' and it has some variable settings and I exported it via features. I will have another module name 'test_features_export' or something like that which contains the component associated with that module. But in some cases, the component can be too generic like 'role' which can be associated with multiple modules. Then its issue to bind to any specific features where it is meaningful.

So my question is , is there any better way to organize the features exports modules ??


texts: Would Drupal send to an alternative email address for reset password?

texts:
I am very new in Drupal.
I have an installation of Drupal 7 with LDAP authentication and LDAP user provision, this LDAP is linked to corporate mail system too. Users have 2 mail accounts (a corporate account and an alternative account), if a user forgot his password, I need the password reset send mail to both email addresses not only to the corporate account.


texts:
For my new project, I'm using the brand new Omega4 theme. It comes with a lot of cool and nice features build in, so no complain about that!

But when I try to use a custom variable in my theme-layout.tpl.php with the hook_preprocess_html(), nothing is passed...

function theme_preprocess_html(&$variables) {
  $variables['my_variable'] = 'My New Variable';
}

When I try to access my new variable in my theme-layout.tpl.php page with <?php print render($page['my_variable']); ?>, nothing is appearing.

Although, if I dpm my $variables in both my template and my html.preprocess.inc file, the dpm in my template is printed first... So it looks like the template is printed first and then the preprocess hook is called.

How can I create a custom variable to use it in my layout template page?


texts: How to use composer for module dependency?

texts:
I installed Drupal 8, and for the Panels module, I had to install the following other modules manually:

Page Manager
Layout
Chaos tools suite

Can we use composer to install modules with their dependencies?


texts: Error: PDOException - Caused by creating Organic Group within Drupal/Cartaro

texts:
Anyone have a solution for the following error:

PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or
near "." LINE 4: INNER JOIN node n ON n.nid = .nid ^: SELECT COUNT(*) AS
expression FROM {comment} c INNER JOIN {node} n ON n.nid = .nid
WHERE (c.nid = :db_condition_placeholder_0) ;
Array ( [:db_condition_placeholder_0] => 320 )
in PagerDefault->execute()
(line 74 of /var/www/html/cartaro/includes/pager.inc).

This error was the result of creating an organic group and then creating content for the newly created group.

More information about the stack I am working on:

Drupal
postgreSQL (MySql is not used)
Cartaro
GeoServer
Ubuntu
Apache


texts: Hi does anyone here use Rhythm Theme for Drupal Commerce. I have a problem when I upgrade to the latest version of commerce in that when I go to create a Product Display it only lists 10 products instead of the many products I have. Not sure if this is a problem with commerce or with the theme I am using.


texts: Create a view to show nodes tagged with certain terms next to each other in comparison table

texts:
I have a content type called 'Product Feeds' that contains hundreds of nodes. These product feed nodes have fields attached; product name, product description, product price and also a taxonomy term field for the shop name.

I want a view that shows me all the terms from 'shop name' vocabulary along the top of a table then all the other attributes in rows so I have a comparison of prices, descriptions etc.

Can anyone offer any pointers in how to do this?


texts: Exlcuded views field doesn't take override template

texts:
Let's say I have a view with 4 fields: Title, Subtitle, Link and Body.
Due to some html output personalization, I excluded the first three fields and added them in the Body field.
For the link content, I previously created an override views-view-field--view-node.tpl.php that actually works in other situations (with other views).
In this case, however, the Link field doesn't display as in the tpl but as the default template (I.e. in my tpl I added some classes to the  tag).
Anyone experienced this and solved?


texts: Unable to show form using controller (module)

texts:
I want to make custom page in drupal with form, I checked few examples showing page in drupal via module and example of form via module, i tried to merge them but no success.
I made a custom page using drupal module with template (twig) file.

Below is my controller code

namespace Drupal\booktestdrive\Controller;
use Drupal\Core\Controller\ControllerBase;

class BiveController extends ControllerBase {
  public function show() {
    $form_class = '\Drupal\booktestdrive\Form\TestForm';
    return [
        '#theme' => 'bive_page_theme',
        '#form' => \Drupal::formBuilder()->getForm($form_class),
    ];
  }
}

Template file code

bive_page_theme.html.twig

<section> hii
{{ form }}

</section>

i also created form at src/form/BiveForm.php

namespace Drupal\bive\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class BiveForm extends FormBase {
  public function getFormId() {
    return 'booktestdrive_form';
  }
  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['first_name'] = array(
      '#type' => 'textfield',
      '#attributes' =>array('placeholder' => t('First Name*')),
      '#required' => TRUE,
    );

    $form['last_name'] = array(
      '#type' => 'textfield',
      '#attributes' =>array('placeholder' => t('Last Name')),
      '#required' => FALSE,
    );

    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Save'),
      '#button_type' => 'primary',
    );
    return $form;
  }

    public function validateForm(array &$form, FormStateInterface $form_state) {

      if (strlen($form_state->getValue('candidate_number')) < 10) {
        $form_state->setErrorByName('candidate_number', $this->t('Mobile number is too short.'));
      }

    }

  public function submitForm(array &$form, FormStateInterface $form_state) {

   // drupal_set_message($this->t('@can_name ,Your application is being submitted!', array('@can_name' => $form_state->getValue('candidate_name'))));

    foreach ($form_state->getValues() as $key => $value) {
      drupal_set_message($key . ': ' . $value);
    }

   }
}

Routing.yml

bdrive.book:
  path: '/brive'
  defaults:
    _controller: 'Drupal\brive\Controller\BriveController::book'
    _title: 'Test'
  requirements:
    _permission: 'access content'

brive.form:
 path: '/brive-form'
 defaults:
   _title: 'Application form'
   _form: '\Drupal\booktestdrive\Form\BriveForm'
 requirements:
   _permission: 'access content'


texts:
In Drupal, the Module Filter module adds four search filters to /admin/modules:

Enabled
Disabled
Required
Unavailable

If "Required" is unchecked, the admin page will only show modules that are not dependencies of any other module. I know that drush pm-list --status=Enabled will show only the enabled modules, but it doesn't filter out modules that are required by other modules.

Is there a way to do the same thing using drush?


texts: How to rename image filename and make same as title field value

texts:
Can somebody also help me to rename the image name same as title field?

I have a image content type where we have title and image field and when I submit the form I want to rename the image name same as the title field. This way I can make my image more meaningful by including keyword in the image name. Right now you can write about 'A' in the title field and you can upload images 'B' and that I don't want.


texts: Create a Gmap with Views that connects locations of different nodes

texts:
I am looking for a way to make some sort of roadtrip website.

The idea is to use two node types: a parent nodetype "Roadtrip" and a child nodetype "Day". The user can create a Roadtrip and add a different Days to the Roadtrip. Every "Day" have a location field that needs to be filled in.

Then, I want to use Views with a Gmap display that I show on the parent Roadtrip node page using contextual filters. On that map, I want to show all the locations of the different Days and connect them to eachother in ascending order by publish date. So visually, you can see which trip someone made in how many days.

I am quite familiair with Views but can't wrap my head around Gmap and it's API so, anyone an idea how to achieve this?


texts: Programmatically remove exposed filter in a view

texts:
I would like to remove a certain exposed filter on the taxonomy term view when certain conditions in the URL are met.

For example, I want to remove the "Color" exposed filter when the user is seeing the /color/red taxonomy term page, leaving only the "Shape" filter available.

Or remove the "Shape" exposed filter on the /shape/square page, leaving only the "Color" one.

The only code I could come up with is this, which is ugly and doesn't even work.

function hook_views_pre_render(&$view){
      if( CONDITIONS_ARE_MET ) {
         unset($view->filter['field_color_tid']);
         unset($view->exposed_data['field_color_tid']);
         unset($view->exposed_raw_input['field_color_tid']);
      }
}

Any ideas?

UPDATE

This is the code in mmo_views_alters:

function mmo_views_alters_views_pre_build(&$view){
    //dpm($view);
    unset($view->filter['field_tipologia_tid']);
}

This is the exported view: http://pastebin.com/JrYDmtZQ

It has 4 filters, and 3 of them are exposed.
I'm using BEF for displaying them, which generated another warning (undefined index filter-field_tipologia_tid) that I solved by patching better_exposed_filters_exposed_form_plugin.inc, line 896:

if( isset($form['#info']["filter-$label"]['value']) )
        $field_id = $form['#info']["filter-$label"]['value'];
else continue;

The warnings that I'm not able to solve are:

  Notice: Undefined index: field_tipologia_tid in
  views_handler_filter_term_node_tid->exposed_validate() (linea 258 di
  /var/www/drupal/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc).

  Notice: Undefined index: field_tipologia_tid in
  views_handler_filter_term_node_tid->exposed_validate() (linea 259 di
  /var/www/drupal/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc).

They appear even with BEF disabled.


texts: User password reset - redirect one time login to another page

texts:
By default, if user submit his email in form at /user/password page, he will recieve an email with one-time login link. After opening this link he is redirected to page with form with one single "login" button - id of this form is user_pass_reset. After click on this button user is redirected to his profile in administrative part of a site: /user/X/edit where he can change his password.

But I have my own custom profile page, where users can change their password and I'd like to redirect user here instead of default profile in administration interface. I already found that user module is checking if old password is needed with this line:

$pass_reset = isset($_SESSION['pass_reset_' . $account->uid]) && isset($_GET['pass-reset-token']) && ($_GET['pass-reset-token'] == $_SESSION['pass_reset_' . $account->uid]);

But I can't find out how to redirect user to my own form on user_pass_reset submit. If I alter this form and change '#action' paramter I get a message that says this one-time login link is invalid. If I add my own submit function $form['#submit'][] = 'activit_password_redirect'; and in this function I call drupal_goto('my/own/form/page') user is still redirected to default profile page.

Is it possible to change url of this form submit?


texts: Drupal 7 doesn't show date field in block but it does in page

texts:
I have a content type with a datetime iso field and pop-up calendar widget.
The field collects an end date too.
In the view (page) and table format it shows correctly.

In the block in unformatted list it shows nothing as date (confirmed by having a label show up like Date:

If I make a new block with a table format then it shows.

So unformatted list can't show date fields with an end date? looks like a bug

Any ideas?

thanks


texts: I have a view containing an unformatted list of fields. I want to create a specific template for the view. I have turned on Twig debug, but it suggests 'views_view_unformatted' for the file name, which would apply to all unformatted lists, but I want it specific to this view. What should be file name be?


texts: Update a user field after commerce checkout

texts:
Im looking for a way to create a rule in drupal commerce that updates a user profile after checkout based on a line item purchased.

Example.  User purchases bulk training hours as a product.  The product has a field called hours which we set to a static number. Assume 10.

When the product is purchased, the hours should be added to the user profile which has a field called training hours.  Whatever the current number of hours in the profile is should be added.  Ie user has 5 hours remaining, pays for 10 more and now shows 15.

I cant figure out a good way to create this rule.

EDIT 2:
So from reading some other posts I see tried to create a component that can be accessed during the loop. For testing purposes I have changed the rule to start when checkout is complete.

It picks up the products and it then loops through the line items but in the loop I still cannot figure out how to access the field called field_coaching_hours that is part of the product.  For not during the loop it emails me each time it finds a line item so I can tell that its working.

I suspect that I need to add up all the field_coaching_hours using a variable and then somehow call a separate rule to add it to the user profile.

Main Rule:

{ "rules_update_coaching_hours" : {
"LABEL" : "Update Coaching Hours",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "commerce_order", "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
  { "commerce_order_contains_product_type" : {
      "commerce_order" : [ "commerce_order" ],
      "product_type" : { "value" : {
          "coaching" : "coaching",
          "consulting" : "consulting",
          "product" : "product"
        }
      },
      "operator" : "\u003E=",
      "value" : "1"
    }
  }
],
"DO" : [
  { "LOOP" : {
      "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
      "ITEM" : { "current_line_item" : "Current line item" },
      "DO" : [
        { "component_rules_get_coaching_hours" : { "current_line_item" : [ "current_line_item" ] } }
      ]
    }
  }
]
}
}

component:

{ "rules_get_coaching_hours" : {
"LABEL" : "Get Coaching Hours",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "mimemail" ],
"USES VARIABLES" : { "current_line_item" : { "label" : "Commerce Line Item", "type" : "commerce_line_item" } },
"IF" : [
  { "entity_has_field" : { "entity" : [ "current-line-item" ], "field" : "field_coaching_hours" } }
],
"DO" : [
  { "mimemail" : {
      "USING" : {
        "key" : "SENT",
        "to" : "myemail@email.com",
        "subject" : "Component Rule Run",
        "body" : "[current-line-item:commerce-product]",
        "plaintext" : "[current-line-item:commerce-product]"
      },
      "PROVIDE" : { "send_status" : { "send_status" : "Send status" } }
    }
  }
]
}
}


texts: How to use replacement patterns as a CSS class for View?

texts: I am trying to figure out how I can use a replacement pattern in the "Other > CSS Class" setting for a view. For example, I would like the View to contain a css class of classname-[nid] with the Node ID as part of the class. Adding the replacement pattern to the CSS Class field results in "Error message - CSS classes must be alphanumeric or dashes only." Does anyone know a creative way to get a field value into the CSS Class, or otherwise apply a field value as part of the overall View class?


texts: Is it possible to create an installation pack in Drush make?

texts: I already have a Drupal 7 running. Is it possible to create an installation package using Make from my current setup. My goal is I have a Drupal 6 version which I need to convert to D7. For the sake of automated deployment I want to replace my D6 core once finished running the scripts to disable modules, features, and custom theme with my Drupal 7 setup before running update.php.