texts: Programatically adding new CKeditor instance

texts:
What is the trick to ckeditor in D8? It's woefully under documented and CKEDITOR / CKEDITOR.instances seemingly return nothing, despite showing multiple instances of ckeditor instances available. CKEDITOR.replace() seems to give a config error (missing 404 js files) when you try to target an element.

I can target and get data back for CKEDITOR.dom.element.get('edit-comment-body-0-value') but once try to use getEditor(), it automatically returns NULL.


texts: How to change views of Entity reference field programmatically?

texts:
In my form I have used auto complete Entity Reference field. I have set style for this field to loads from specific views instead of content.

I have created a view with two entity reference output. EntityReference_1 and EntityReference_2

by default entity reference field is loaded by EntityReference_1 result.

But in some cases (for example if specific user or role is logged) I want to alter the form and force auto complete Entity Reference field to use EntityReference_2 result .

Please guide me, How can I do this?


texts: Set the id property of a form element using D6 Form API?

texts:
I want to set the id property of an input element of a form that I'm creating in a module using the form API. I'm doing this  I looked up the documentation and it says this:

id
INTERNAL. Used to populate form elements' id property. In rare cases,
you can set this value yourself on a form element, to override the
default setting.

It doesn't really say when I can or can't use it, so I'm hesitant to try to do this, since I can't rely on it.
I'm writing some javascript that has the id of the element hard-coded into it. Should I use the Drupal-generated id in my script instead?


texts: get node by address field and part of name

texts:
I have a content type which have a name field and address field.

I want to retrieve programmatically all the nodes in a specific city and wich contain in his name one or many keywords.

For example i want to search in "Paris" the node wich contain in name the word "beautiful" and/or "shop". Then i can retrieve theses results :
- "My beautiful shop of candies" in "Paris"
- "Fast shop" in "Paris"

The problem is that i don't know how to get nodes by a word containing in :/

Here is my current code :

$query  =  new EntityFieldQuery();

$entities  =  $query->entityCondition( 'entity_type', 'node' )
    ->propertyCondition( 'status', 1)
    ->fieldCondition( 'field_adress', 'locality', 'Paris', 'like' )
    ->fieldCondition( 'field_name', 'value', array('beautiful', 'shop', 'money') )
    ->execute();

dsm($entities);

I tried to change :

->fieldCondition( 'field_name', 'value', array('beautiful', 'shop', 'money') )

to

->fieldCondition( 'field_name', 'value', array('beautiful', 'shop', 'money'), 'CONTAINS' )

but I get this error :

  Warning : addcslashes() expects parameter 1 to be string, array given
  dans DatabaseConnection->escapeLike() (ligne 984 dans
  /Applications/MAMP/htdocs/fritr/includes/database/database.inc).


texts:
I am customizing the user registration in the template file. I want to auto submit the registration form using Drupal code, or JavaScript code.

Does anyone know how I should achieve this?


texts: I am working on a requirement where I have a link "get report". When User clicks it, the information is fetched from DB and a PDF report is generated. Finally the PDF file will be shown to the User to download or view in browser. I want to know what is the better way of implementing the link, onclick functionality. Do I have to use Ajax module or something else. Please help.


texts: How do I redirect a user role on login (Drupal 6)?

texts:
So I want to create a new user role (already done) and redirect them to a certain page (and use a certain menu) when they log in.

I'm not seeing any specific place to do this under roles or permissions - does it need a third party module? I can give a list of the modules my client is using if that helps.

Note, this is in Drupal 6.


texts: Architecture for login in. Accessing Drupal serivces from a phonegap mobile app

texts:
I want admins login in a drupal website to create nodes that are specific to clients.
And clients login in using a mobile app to retrieve the node's info.

I'm not a 100% sure of the best architecture practice for this. Any suggestions or tutorials?

For the website, I've got Drupal 7 with services 3 using Rest and I'm creating some nodes.
I've got the Oath module set up but using session could be easier.

For the app, I followed the phonegap tutorial until it showed the phonegap hello word, then I just started modifying index.html.

PS:JQuery's AJAX Post probably not a good idea because the requests can not successfully retrieve data from a different domain, subdomain, or protocol.

PSS: If it's possible, maybe I should include Drupal for the mobile part too instead of just the website that creates the services. This way I can use drupal_http_request

PSSS: Looks like I could use php's curl but would it work with a simple phonegap env


texts: Hook_view_pre_render(&$view) to alter field_title link locations

texts:
I have a function in a custom module:

function mashavumodule_views_pre_render(&$view) {
    dsm($view);
}

After clearing the cache, I had a dump of $view but know my question is:

If I want to alter the location the the field_title links to, what part of the $view array should I alter and is hook_views_pre_render the best hook to use to do this?


texts: How to add two registration form on single page?

texts:
How can i add two registration form on single page

I had created two registration page using the Profile 2 module and given a custom path,eg:

http://localhost/dupal/member/register
http://localhost/dupal/non_member/register

How can I display that two form on single page
eg:http://localhost/dupal/user/register


texts: How do I update without using the parameter --with-dependencies in "composer update --with-dependencies"?

texts:
I just finished my first Drupal 8 project, and I want to have it up-to-date before submitting it to the remote server. I read that it's better not to use composer update --with-dependencies. I understand why this is. I will do this for the core and modules, so I updated core with composer update drupal/core --with-dependencies and one drupal/module but then when I run composer outdated I still see a large list of symfony/twig/phpunit/zendframework/and more.

Do I really need to update them one by one? It seems a lot of work to do this every time. There are maybe 30 or 40 to update.

Hope someone can explain me how this works.


texts: Use one controller in custom Block and Page

texts:
I have a custom module with a page and block.
Both will use same API but with different queries and also both will display API data in the same page.
To be more explicit, I have a simple search on my homepage, when searching something, the user will be redirected to page "/search-test" with results.
In that page user has more filters to search.
It is possible to use same controller?
If it's not possible, how can I use 2 different controllers but display data on same page?
At this moment when I search something in homepage, I will be redirected to "/search-test" page but with default result, my page controller is being called and display that data instead of block controller (homepage).
My block twig:
<form id="search_data" class="form-item" name="search_data" action="/search-test" method="post" accept-charset="UTF-8">
    <fieldset>
        <input class="" value="" placeholder="[Name]" type="text" id="search_text" name="search_text" maxlength="256" autocomplete="off">
        <button type="submit" form="search_data" class="button">{{ "Search" }}</button>
    </fieldset>
</form>

My page twig:
<form id="search_data" class="form-item" name="search_data" action="/search-test" method="post" accept-charset="UTF-8">
    <fieldset>
        <select name="items_per_page" class="form-select">
            <option value="5" selected="selected">5</option>
            <option value="10">10</option>
            <option value="40">40</option>
        </select>
        <button type="submit" form="search_data" class="button">{{ "Search" }}</button>
    </fieldset>
</form>

I am using same  elemnt.
In both controllers I'm using curl to receive data from API.
My block return controller:
return [
    '#theme' => 'homepage-search-block',
    '#title' => 'Title',
    "#homepageSearchList" => $searchData
];

My page return controller:
return [
        '#theme' => 'search-list',
        '#title' => 'Title',
        "#pageList" => $searchData
    ];

Everything works good without redirect, when I redirect user to "/search-test" the page controller is called and results will be different.


texts: How to render content with  in twig to create paragraph

texts:
Sorry I'm newbie in drupal 8
I want to render my content from database which have
 tags inside and my expectation every
content
 will create new paragraph
My database content was like this:

Content 1

Content 2

Content 3

I was try using {{ content.value |raw }} but it was render all content without create new paragraph

I also try using {{ content.value | raw | nl2br }} and {{ content.value | replace({"\n": "
"}) | raw }} but this one create double
 every paragraph so my paragraph become annoying

Is there any solution in twig to render
 tags to create beautifull paragraph?

Thank you


texts: My custom normalizer doesn't get executed

texts:
I'm building a REST api with Drupal 8 and I want to override the normalizer for the Formated Text field type.

I started with this example module: https://github.com/jazzdrive3/example_normalizer

example_normalizer.services.yml

services:
  example_normalizer.normalizer.formatted_text.json:
    class: Drupal\example_normalizer\Normalizer\FormattedTextNormalizer
    tags:
      # Give it a priority higher than the default jsonapi service
      # serializer.normalizer.field_item.jsonapi
      - { name: normalizer, priority: 22 }

FormattedTextNormalizer.php

<?php

namespace Drupal\example_normalizer\Normalizer;

use Drupal\jsonapi\Normalizer\FieldItemNormalizer;
use Drupal\text\Plugin\Field\FieldType\TextItemBase;
use Drupal\jsonapi\Normalizer\Value\FieldItemNormalizerValue;
use Drupal\filter\Entity\FilterFormat;
use Drupal\filter\Plugin\Filter\FilterHtml;

class FormattedTextNormalizer extends FieldItemNormalizer {

  protected $supportedInterfaceOrClass = TextItemBase::class;

  public function normalize($field_item, $format = NULL, array $context = [])
  {
    /** @var \Drupal\Core\TypedData\TypedDataInterface $property */
    $values = [];
    // We normalize each individual property, so each can do their own casting,
    // if needed.
    foreach ($field_item as $property_name => $property) {
      if ($property_name == 'value') {
        $value = $property->getValue();
        $format = FilterFormat::load($field_item->format);

        $filter = $format->filters()->get('filter_html');
        $property = $filter->process($value, 'en')->getProcessedText();
      }

      $values[$property_name] = "HELLO";
    }

    if (isset($context['langcode'])) {
      $values['lang'] = $context['langcode'];
    }
    return new FieldItemNormalizerValue($values);
  }
}

But my test string "HELLO" doesn't get printed out in the json.
Also, the documentation about overriding normalizers is very rare and the few articles I found say different things (especially about the example_normalizer.normalizer.formatted_text.json key in services.yml).

Some say it should start with serializer., some other say it should start with example_normalizer.... anyway I'm a bit lost here...

Any help would be very much appreciated.


texts:
I have a webform with some fieldsets. Within each fieldset is a set of input elements that are the same for each fieldset, and each set of elements has the same machine name.

One of the elements is a "Select options" as a set of checkboxes. I want to conditionally make some checkboxes readonly or disabled for all of the fieldsets.

My problem is that I have spent hours looking at how to do that, and I cannot find the elements within the $form object in order that I may alter them. The form is a multi-page form, so that may cause some problems, as I don't know if all of the elements show up in the submitted array until you have reached a specific page or not. I don't know how that works.

Part of my form has something like this:

outer_fieldset
-- count
-- fieldset_1
-- -- name
-- -- date
-- -- group
-- -- checkboxes
-- fieldset_2
-- -- name
-- -- date
-- -- group
-- -- checkboxes
-- fieldset_3
...

I used die('<pre>' . print_r($form['submitted']['outer_fieldset'], TRUE) . '</pre>'); to look at the data. $form['submitted']['outer_fieldset']['fieldset_1'] exists, but it doesn't have any elements inside it for the checkboxes or anything.

All the existing SE pages I have looked at give basic answers like $form['submitted']['element_name']['#attributes']['disabled'] = TRUE;, but I cannot use something like that unless I can find the element objects...

Could the fact that the inner controls all have the same machine name be causing a problem with that? The webform was created using the Drupal interface, and it allows controls to be added this way. I'm relatively new to Drupal. Any help on how to find and alter the attributes of these elements would be great. Thanks.


texts: Passing $form_state data into \Drupal::entityQuery('user')

texts:
I have the following D8 form

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['bulk_perfplans_roles'] = array(
      '#type'          => 'checkboxes',
      '#title'         => $this->t('Generate plans for which roles?'),
      '#options'       => user_role_names(),
    );
    $form['bulk_add'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Create new Performance Plans'),
    );

    return $form;
  }

I'm trying to pass the information into an entityQuery as follows...

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $selectedRole = $form_state->get('bulk_perfplans_roles');
    $uids = \Drupal::entityQuery('user')
      ->condition('roles', $selectedRole)
      ->sort('created', 'ASC')
      ->execute();

I'm trying to make it so it conditionally alters the query based on the user selected roles from $form_state. It's currently not working, and I'm not sure where to go next. Any thoughts?


texts: How to access fields from a goal when creating a node with Rules?

texts:
I'm trying to create a rule with the Rules module that posts a node when users achieve a goal (using the Goals module 7.x-1.3). I want to get fields from the goal like the goal image and other fields, but there's no data selector for the goal completed.

I can't find a way to fetch the completed goal entity. I've tried using a data comparison condition, but it'll only give "goal" data selector without any fields.

Any hints?


texts:
I am using Commerce Kirckstart installation.

I would like to  change a field in commerce_customer_address.
I only want a new field, like telephone and I would like to remove State.
Some one knows how to do without code.
thanks


texts:
In drupal8 site, I have views for showing blog content created a twig file  and wrapped with some HTML tag for theming the blog page. Consider I have 10 content on one page. During particular interval for some content/row HTML wrapper in twig is not adding, so the particular content design breaks. I cannot find the reason for this issue. Kindly help to solve.

Note: I have varnish cache enabled.

Actual content.

     -- custom tags

        {{ content }}

After some time it changes to

   {{ content }}

If I clear the cache, it again adds HTML tags to views row.


texts:
We have a cck field called "keywords". We need to add this field to the solr index so we can search on it from outside of drupal. How are CCK fields managed in the solr index?

UPDATE:

I created a module "apachesolr_search_additions" and the following function:

<?php
function apachesolr_search_additions_apachesolr_update_index(&$document, $node)
{
  if (isset($node->field_keywords_raw) && !empty($node->field_keywords_raw))
  {
    $document->addField('sm_keywords', $node->field_keywords_raw[0]['value'], '2.0');
  }
}

I then ran cron and went to:
admin/reports/apachesolr

it does NOT show the field name in the search index. How can I verify it is in the index?


texts: How do I automatically set price (and hide on Commerce product creation form)?

texts:
I'm building a site where the product node admin(s) do not need to set prices on creation --  How do I hide the Price field on the node creation form, then use a rule to set the price?

Thank you!


texts: Conceptual Question...Link to an exposed filter result created by a view in Drupal 7

texts:
I haven't been able to find the answer by searching, so i thought I would pose this question, I realize there may be more than one right answer, but basically I want to link to a specific result of an exposed filter without having to disable ajax.

I have a block created by a view on a panels page which will have the latest 4 magazine issues. (image and link) I want to link to a specific result in the exposed filter, when the user clicks-through.

The exposed filter has year (-3+3) and season which has the taxonomy terms (fall, winter, spring, summer) The default (when terms are not selected) is to show 4 of the latest magazine issues sorted by most recent.  Since there are only 4 issues per year and the year will be relative to "now"; Would the way to go about this be to clone the view with the exposed filter page 4 times for each season? How would one re-write the link to go to that specific result in the exposed filter? I'm sure there are other options, to achieve this, so please let me know.

Thanks.


texts: Search API view - Displaying items that doesn't meet Facets criteria

texts:
I have a search api view where I display houses with number of bedrooms in each of the house, and I'm using facet api to create filter so that for example if I would click on "2" it would only display houses that have only 2 bedrooms in it.

But I would also like to below this view (or as part of this view) display other results that doesn't meet the criteria (and that are filtered out by facets) and I'm really stuck with how this can be done.

In addition I only want it to happen with "Bedrooms" but not with "Bathrooms".

I hope someone can help I'm really stuck with this issue!

** small update 26.09.2015 **

I'm trying to achieve that now by combining two views together using views attachment and having "views negate" filter to work on values provided by exposed filter.. so far no luck.

And views attachments are being displayed UNDER pagination, instead of after the normal results which is not what I ideally would want to have.

After that I'm planning to change the normal exposed filter into BEF with links and style them as facets...


texts:
I have installed the XML Sitemap module, and enabled the xmlsitemap_menu sub-module.  I found how to add the main menu to the sitemap (via this site - no thanks to the module's documentation). When I go to the XML Sitemap admin page, it lists mysite/sitemap.xml as having 91 links and 1 pages. Shouldn't the page count be higher?  Also, I would like to view the generated output, but when I click the sitemap.xml link, all I get is a table with link to the front page.

How can I see the actual XML or sitemap output?


texts:
Found it useful and did not find any contributed module to fulfil this so, adding it for knowledge purpose.
Stuck in a situation where we need to hide a block for certain role.
Drupal 8 has functionality to hide for certain URLS.
But, for Roles, only show condition is there not Hide.
I have already answered my question and I would love to accept another solutions.
Please suggest a solution.


texts:
I have done something and can no longer edit the manage display pages for the article content type .  When I try to visit them I fall out of the usual rich html interface into a page whose code is attached below.  I think that this is happening because I have accidentally damaged or removed the full content view mode for the article, but I am a newbie so I am really not sure.  I was playing with Display Suite when this problem began.

Any ideas what is going on? and how to fix it?  Thanks.

You are here

Home » Administration » Structure » Content types » Article

Article

Add to Default shortcuts

Primary tabs

Edit

Manage fields

Manage display(active tab)

Comment fields

Comment display

Secondary tabs

Default(active tab)

Teaser

Content items can be displayed using different view modes: Teaser, Full content, Print, RSS, etc. Teaser is a short format that is typically used in lists of multiple content items. Full content is typically used when the content is displayed on its own page.

Here, you can define which fields are shown and hidden when Article content is displayed in each view mode, and define how the fields are displayed in each view mode.


texts: How to set up file system configuration to save files on another hard drive

texts:
Since users are allowed to upload large files i have setup like this: sites/dafault/files/uploadfolder/username/folder/

Shortcut to another harddrive on server is setup so files under /sites/dafault/files/uploadfolder and all coming after are saved to that drive.

When admin or user uploads the file i see that correct folders are made (files/uploadfolder/username123/folder/) but the file itself can not be saved with this error:

Warning in log: "The upload directory public://uploadfolder/username123/folder for the file field field_name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled."
Permissions are 777.


texts:
I am trying to develop a simple module in Drupal 7. I want to return a table with some data in a function, which i am able to achieve. I am stuck in the pager part though.

I used

pager_default_initialize($total, 10);
$html .= theme('pager', array('quantity',$total));

and I can see the pager below my list, also I have 21 records for now and it shows << < 1 2 3 > >> which means it calculating 10 records each.

But my issue here is I can see all the 21 records at once regardless of whichever page I go to. I suppose I have goofed up my page_query.
When I tried using $query->limit(10) it gives error Fatal error:

  Call to undefined method SelectQuery::limit() in C:\xampp\htdocs...............

If I comment $query->limit, there's no error but it does not work completely.
This is my query

$query = db_select('profile');
$query->fields('profile', array('id', 'name', 'store_name', 'company', 'city', 'email', 'phone'));
$query->orderBy('id', 'DESC');
$query->extend('PagerDefault')->limit(10);
//$query->limit(10);
$results = $query->execute();

Please help!

Thanks in advance! :)


texts: Conceptual help needed for creating forms related to parent node

texts:
I would like to ask for your opinion in creating a solution for the following application requirements. The general purpose of the application is to administrate students, teachers and courses much like a school administration software.

Some content-types will have related forms (original format is PDF) that are filled in partially by the user and partially by the application.
After filling in the required data, the forms must be printable (PDF) and stored for future editing and printing again. The filled form must always stay related to a specific parent node. Means, if the user views or edits the content of a certain node, he needs to see the related forms and be able to click on them to fill in data or edit or print the filled in form again and again.

A small example.

Content-type: student (node)

- related form: attendance
- related form: enrollment

Properties of the related forms:

- original forms are available as PDF files
- some fields are filled in programmatically, taking data from the currently viewed student node
- other fields are filled in manually by the user
- filled in forms need to be printable (PDF) or send as mail attachment
- filled in forms need to be stored for future printing / editing
- forms always need to be related with their parent student node

My targeted solution is as follows using as example the form "attendance":

programmatically create and validate the form "attendance"
store the filled form as a PDF file in the file system
add the PDF as attachment to the related student node
add an edit button beside the attachment that leads the user to the filled form (for editing and printing again)

Could this solution work?
Does anybody have ideas or hints for a better solution?
Any comments are very appreciated.


texts: Block loading behaviour in Drupal 8 in a performance sense through the visibility settings

texts:
The following scenario:
- i have for example a standard block region through a pages of a site: "highlights"
- for the frontpage i have an additional region: "highlights_frontpage"
- i put a block into "highlights_frontpage"
- i have to put into the visibility textarea: ""

If i remember correctly for D7, otherwise the block is loaded everywhere even though he is only shown on the frontpage.

Has Drupal 8 the same behaviour in loading blocks?
My page has for each main menu page an own region, but it would be a little bit ugly for the editor if he has to place the block via the administration in one region and also has to set the visibility ...

thanks


texts: individual role permission rather than automatic selected

texts:
I have used that module but can't remember the name & can't find it anywhere.

Suppose I have 4 roles in the site:
Anonymous user
authenticated user
Elite user
administrator

As you know, Drupal automatically permit all created roles more than authenticated role user.

If I give permission to skip comment approval to authenticate users, then it automatically allow elite users to skip comments approval.

but for my site, I have a field that I want authenticated user to edit, but no the elite user. As this field data will actually will make the user an elite member, so I can't let them change this in the future.

How can I check the box each role permission manually?


texts: Is it possible to create with something similar to this store locator using Drupal?


texts:
So I have included a date field in my custom block form and would like to use the date.

However it is saved as an array which I am finding a little difficult to work with:

  The format for "#default_value" and "#return_value" is an
  array with three elements with the keys: 'year', month', and 'day'.
  For example, array('year' => 2007, 'month' => 2, 'day' => 15)

What is the best way of getting this "date array" into something I can use strtotime() on? Am I missing some Drupal way of allowing me to format this nicely into a string?

What I have working seems to be very long winded and static:

$startDate = variable_get('start_date', NULL);
if (isset($startDatea)) {
  $startDate = $startDatea['month'].'/'.$startDatea['day'].'/'.$startDatea['year'];
  $startDate = date('Y-m-d', strtotime($startDate));
}

I am sure there must be a nicer way.


texts: Edit Drupal Form in "popup" just like it is done in Drupal Views Edit form

texts:
I am making replica of views module. We when navigate to view in admin/list/structure, we add new view. Here we type name of our view and content type. After clicking "save and continue", it is redirected to view edit page.

On the top, there is,
Title
title:None
And when we click on "None", a popup box will appear to edit title of the view and replaces "None" with the title given by us.

I need to have this edit in popup functionality. Can anyone please help doing it.


texts:
I foolishly created a features module and named it events. This is bad because, of course, there is a registered module with that same name. So the update status report is always in error and drush has to lock the module so it doesn't attempt to "update" it.

I would rather not uninstall, recreate, reinstall because I will have to recreate content (yes, I have backup/restore installed).

Is it possible (advisable) to rename the directory and files, edit the .info, and edit the record in system?

     ericx ** drupal_addicted ** Wed Sep  3 15:26:29 2014
     sql> select * from system where name='events'\G
    *************************** 1. row ***************************
          filename: sites/dev.addictedtoagility.com/modules/custom/events/events.module
              name: events
              type: module
             owner:
            status: 1
         bootstrap: 0
    schema_version: 0
            weight: 0
              info: a:11:{s:4:"name";s:6:"Events";s:11:"description";s:49:"Adds the Events content type and supporting stuff";s:4:"core";s:3:"7.x";s:7:"package";s:8:"addicted";s:7:"version";s:7:"7.x-0.1";s:7:"project";s:6:"events";s:12:"dependencies";a:8:{i:0;s:4:"date";i:1;s:11:"event_sites";i:2;s:8:"fe_block";i:3;s:4:"file";i:4;s:4:"list";i:5;s:14:"node_reference";i:6;s:9:"strongarm";i:7;s:5:"views";}s:8:"features";a:7:{s:6:"ctools";a:2:{i:0;s:21:"strongarm:strongarm:1";i:1;s:23:"views:views_default:3.0";}s:17:"fe_block_settings";a:1:{i:0;s:20:"views-events-block_1";}s:12:"features_api";a:1:{i:0;s:5:"api:1";}s:5:"field";a:5:{i:0;s:22:"node-event-field_dates";i:1;s:33:"node-event-field_event_event_site";i:2;s:22:"node-event-field_judge";i:3;s:24:"node-event-field_premium";i:4;s:27:"node-event-field_start_time";}s:4:"node";a:1:{i:0;s:5:"event";}s:8:"variable";a:14:{i:0;s:23:"comment_anonymous_event";i:1;s:26:"comment_default_mode_event";i:2;s:30:"comment_default_per_page_event";i:3;s:13:"comment_event";i:4;s:27:"comment_form_location_event";i:5;s:21:"comment_preview_event";i:6;s:27:"comment_subject_field_event";i:7;s:25:"date_format_month_and_day";i:8;s:33:"field_bundle_settings_node__event";i:9;s:18:"menu_options_event";i:10;s:17:"menu_parent_event";i:11;s:18:"node_options_event";i:12;s:18:"node_preview_event";i:13;s:20:"node_submitted_event";}s:10:"views_view";a:1:{i:0;s:6:"events";}}s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;}

1 row in set (0.00 sec)


texts:
I'm new at Drupal and I am having trouble with comments in some content types.
I create a new content type and check that it'll hava comments, but I don't want the Wysiwyg editor, so I disable it, but it's still there, how can I disable it for a content type speciffic?
NOTE: I Turn off the Wysiwyg comments in this content Type.


texts:
I have created a Drupal 7 site with all required functions. As per the requirement I have to create a mobile theme for this site, which I did effectively. Now problem is I need to redirect the user to the mobile site if the request is made from a mobile. If the request is made from computer he should be redirected to the main site.

Thanks in advance.


texts: Making custom database text fields available for search

texts:
I have a custom module that stores text records in a table, however this table records are  not mapped to nor an entity neither a node, so as far as I know, I can't expose them to the search module or the search API.

So my question is how do I expose my data (custom table fields) to Drupal so I can use some sort of search module (preferably search API or the core search) ?.


texts: Views list content from different content types

texts:
View is setup to list content from content type B and C.

Content B has title, image and date field.
Content C has title and date field, and i want to pull image field from content creator.

When users creates content type A which is mandatory after registering (B and C can not be created before A), image field is mandatory and it is possible to upload only 1 image in each of those (A, B and C).

How can i pull image field from A (for C), while listing B and C ?


texts: Make block visible to specific IP (in D6)

texts:
On a D6 site I want a block that it visible only to visitors from a specific IP. If I choose Page specific visiblity settings with the PHP code

<?php
  if(strcmp(ip_address(),'1.2.3.4')==0) {
    return true;
  } else {
    return false;
  }
?>

it works fine on all pages, except for the front page.

How can I make this setting work also on the front page?

Is this snippet not executed on the front page?

Update: Or is this some caching issue? It's working on the front page, if I connect with https. But block caching is disabled on the site.


texts: Is there a way to programmatically add an array of images from a particular file path? I want to add all the images from one folder in my drupal site and add fancybox styling to them. Can this be done? I've tried looking on drupal.org with no success.


texts: Display a Block for mobile only without creating new theme

texts:
I'm trying to display a main navigation menu block but ONLY for the site when it's viewed on a mobile. I need to do this without creating a new theme to do so though so it all works on 1 theme only.

Any ideas how this can be done?

Thanks


texts: Filtering nodes shown on taxonomy menu block

texts:
As in the picture, the taxonomy terms are showing count of nodes tagged with the term( using taxonomy_menu module). That nodes are of type classified ads.

Is it possible to filter out expired ads ? I mean in the picture, the first menu item is "10th" with 24 nodes in it. But I want to filter out 5 nodes which have expired containing a hidden flag that it has expired. So that is should show as "10th(19)"

How can I do it?

Looks like in the file taxonomy_menu.database.inc we have this function:

function _taxonomy_menu_term_count($tid) {
  $result = db_select('taxonomy_index', 'tn');
  $result->condition('tid', $tid);
  $result->join('node', 'n', 'n.nid = tn.nid AND n.status = 1');
  $result->addExpression('COUNT(n.nid)', 'term_count');
  $temp = $result->execute();
  $temp = $temp->fetchObject();
  return $temp->term_count;
}

Along with n.status I should add n.field_expired check to exclude I think.  I wouldn't mind to temporarily hack the code of Taxonomy Menu though.


texts:
This is the first time I want to create a multilingual website. The site is Turkish now and I want to add English as second language (for both interface and content).

The main site (the Turkish one) has about 15 content types and each content type has 10-20 fields (text, entity reference, date, image etc). Also each content type has its own node.tpl.php and I made lots of customization to display node types. In short, the site is a bit complex.

I made some research about creating multilingual site (in Drupal of course) but I couldn't decide yet to use Drupal's multilingual features or to clone the Turkish site and create another site for English with some (language) modifications.

Creating two separate site is easier for me but using Drupal's multilingual features seems the "correct" way but more painful.

How to decide to create a multilingual site or to create different site for each language?

(More details: - Almost all of the contents in the Turkish site will have its corresponding content in the English site. - There is a team of non technical editors.)


texts: Can't get Flagging API to accept POST request

texts:
trying to use the REST API that comes with the flagging module on Drupal 8.

I've enabled and secured the endpoint that comes with the module: /entity/flagging: POST

I'm nearly there, but following examples from earlier releases don't seem to work; What I'm trying to achieve is adding a flag for one user (1) for one content item (34). I got this far on the POST:

{
"entity_id":[{"target_id":34}],
"flag_id": "my_flag",
"uid": [{"target_id": 1 }],
"flag_action": "flag"
}

But I get this error:

InvalidArgumentException: Field flag_action is unknown.

Without the flag_action argument though I get:

{"message":"You are not authorized to create this flagging entity of bundle my flag."}

I'm not sure how I can not be authorised i'm sending credentials of the sys admin (using basic_auth).

Anybody know how I can add or remove a single flag from an entity using the Rest API?
thanks!


texts:
In a route, say password_recover/?code=XXX

How can I make codea required parameter? i don't have control over the system that appends the parameter to the url.


texts: Change CCK Nodereference View at runtime

texts:
I have a CCK nodereference field, displayed as a dropdown, and populated by a view.

I'd like to change that view depending on user permissions.  Can I change the view programmatically before it gets rendered?

I can't do it in hook_form_alter() because CCK isn't available here.
So I set up an #after_build, and inspect here.  But this seems to late.  The #options have already been rendered and there's no view property to change.


texts: Can/should I reference library assets outside of the theme folder with relative paths?

texts:
I'm looking at a theme starterkit called Particle that produces output for different apps, including Drupal. Because of this, the directory structure is atypical for a Drupal theme: you put particle in your themes directory and the Drupal theme's actual info file is at particle/apps/drupal. Built assets like CSS and JS are placed in particle/dist. By default it uses an absolute path in the libraries definition:

core:
  css:
    theme:
      /themes/particle/dist/app-drupal/assets/app.styles.css:
        preprocess: true
js:
  /themes/particle/dist/app-drupal/assets/app.js:
    preprocess: true

I'd rather use a relative path, but I'm aware I'm referencing assets that are outside of the theme: does anyone know if that's likely to cause problems? (Just to be clear, it seems to work fine, but I'm wondering if there might be some gotchas!)


texts: How to validate email on webform if the field type is textfield and you have data

texts:
by mistake, on a webform, in the field e-mail we selected fieldtype = textfield instead of email type, no problem to change it if you do not have data, but if you have data, when you delete the field all your data is gone.
o
So the email field is NOT validate to enter just email addresses. How to validate this field without export and migrate the data?


texts: Overide mail MIME inline image attachment process

texts: How can I override this the proccess of images being sent through drupal_mail(), using htmlmail and mail MIME, being converted from image references to inline image attachments? I want the images to remain references.


texts: Configuration override not work from settings.php

texts:
I add the following to the end of my settings.php

$config['system.site']['name'] = 'Drupal 8 DEVELOPMENT';

When I run drush cget system.site name it still displays the old site name.

Any idea why it wouldn't be overriding?


texts: how to? if is_front = div class "front-content" else "content"

texts:
I have a view that displays the latest articles on the front page and it links to the full article. I want to force a div class to the front page to 70% so I tried to add these lines to both block.tpl and page.tpl and it doesn't take into account the condition, it just sets to front-content on both displays.

Here is the code:

<?php if (!$is_front): ?>

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

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

    <?php endif; ?>


texts: Adding "terms" on the fly and/or mutiple term referance submission with "unlimted values"

texts:
I have an issue which I’m hoping you guys can point me in the direction.  I’m currently building a music press/media site in which I want to use “terms” for things like the artists, venues etc.  Eventually writers will be able to submit their work via the normal add content route and all the various terms will be created when there filling out the submission form.  At the moment I’m using a “Term Reference” field with the “Autocomplete term widget (tagging)” widget to add in the main artist.  I have a separate field for the support artists  with the Number of Values option set to “unlimited” however I don’t get an option to add another support artist in (like you would if the fields reference was set to text).

So I’m looking for a way to get an option within the node submission form to keep on adding support artists as term references  and/or a method of adding term references on the fly so they can be selected via a drop down list whilst the submission form is being filled out (i..e not the term references are add and in place before the form is saved.
Any help on this would be mostly appreciated as this has had me stuck for a while now.

Thanks.


texts: What is the difference between drupal_get_form and drupal_retrieve_form?

texts: What is the difference between drupal_get_form() and drupal_retrieve_form()? Can someone explain the difference?  I look at the API, but the description seems similar to me.


texts: There's a problem I still couldn't find a good solution with Views, I'm using Drupal 7. I have a view form that searches for apartments for rent in a specific location. There are two combos in the form: one listing the cities, and another combo listing the districs. I want the district combo to be shown only when the value selected on the city combo is "New York", for example.


texts: Rewriting a field in organic group member view

texts:
I am not sure if this is possible..

My organic group 'member view' filters all the members of a particular group.
I have created the view so that the first member gets listed in a sidebar to become a link  'members' pointing to the complete member list for the current group.

The same view is used for a different grouptype.
So the first member gets listed as a link as well.
However with this grouptype i want my 'first member link' to be 'rewritten' as 'friends' instead of 'members'

Can this be done with one view?

I have tried using two fields to display rewriting one as 'members' and the other as 'friends'. Without succes i tried finding a proper relationship for them....

Help appreciated.


texts: Can MySQL 5.6 be used with Drupal 6 and php 5.2.17

texts:
A server admin is looking to update the production mysql from the latest version 5.0 to latest 5.6. We are running a Drupal/Pressflow 6.22 and php 5.2.17. I believe this is going to bring on the apocalypse when it comes to things not working, but I need some concrete reasons on what may break and why.

Do anyone have any experience running a drupal 6 on mysql 5.6? Or PHP 5.2 with MySQL 5.6?

I know mysql 5.1 in acted strict mode in MySQL.

Anyone have any insight into if these will play nice with Drupal 6 and it's modules?


texts:
I use MAMP on Mac.

When I try to use drush en omega command on drupal root directory to install omega, But the terminal throw me an error:

drupal-7.23 tangmonk $ drush en omega

Command pm-enable needs a higher bootstrap level to run - you will   [error]
need to invoke drush from a more functional Drupal environment to run
this command.

The drush command 'en omega' could not be executed.                  [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]

Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.

Drush was attempting to connect to:
 Drupal version         :  7.23
 Site URI               :  http://default
 Database driver        :  mysql
 Database username      :  root
 Database name          :  drupal
 Default theme          :  garland
 Administration theme   :  garland
 PHP executable         :  /usr/bin/php
 PHP configuration      :
 PHP OS                 :  Darwin
 Drush version          :  7.0-dev
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/tangmonk/Sites/drupal/drupal-7.23
 Site path              :  sites/default
 File directory path    :  sites/default/files
     * connect the database through a socket. The socket file may be
    wrong or the php-cli may have no access to it in a jailed shell. See
    http://drupal.org/node/1428638 for details.

It seems mysql issue. But my site run perfect.


texts: How can I create special search with check/uncheck image field in filter criteria of views

texts:
How can I create special search with check/uncheck image field in filter certia of views module in drupal 8 ?

I want if users check image field checkbox and click on "go" button , they whatch only content that have image and when uncheck that they can watch all content .


texts: Ignore "invalid" or incorrectly formatted Emails addresses (on Signup/User Import)

texts:
I am importing a large set of users from a old CMS that has about 10k+ users that have no email or badly formatted emails.

I want to force this to import, but Drupal wants to validate the email string.

Is there anyway to temporarily disable this?


texts: related content types - "top 10 best movies" functionality

texts:
Been trying to achieve functionality like below.
- Article "Top 10 best movies" when you enter the article it is a landing page with short text and then there are links to all ten movies - 10 through 1 like below:

Tried to do it with two content types - top10(the landing page) and movie(each movie from the top 10 list). Entity reference field on the movie content type pointing to the top10(the landing page). Then made a view listing all movies and filtering by the NID of the main article. But then when I enter the movie content type the links disappear (the nid of the top10 content type is missing). Then tried to make the view to be filtering by the etitiy reference field but then links pointing to other top10 articles appear... Fairly new to drupal and seems like I have meesed it up.

If someone can advise some clean idea would be much appreciated. Thank you in advance.


texts: how to show a link only on my own profile node?

texts:
tried this code:

<?php
global $user;
if (arg(0) == 'user' && $user->uid == arg(1)){
$url = privatemsg_get_link(array(user_load($node->uid)));
print '
'. l(t('Send a private message to the author'), $url, array('attributes' => array('class' => 'lichnoe'))) .'
';
}
?>

but this doesn't works. It displays on my own profile, but doesn't displays on other user's profile. What i'm doing wrong?


texts:
I am using recruit distribution, I have configured everything but one thing that is giving me headache is how can I change the blocks in the jobs search page, I could not find any way nor any template file where I could make any changes for this page.
Please find the link below to get an idea.

http://drupaljobs.epiqo.com/search/job?search=&field_job_region_parents_all=

On the left sidebar I dont have any option to add any new facet block, I am confused is it a panel page or through template.if its a template then which template file is installing this sidebar, Same is the case with the recruit resume search page.

Please find the screenshot attached


texts:
I want to pass the value from module to page tpl file in drupal.I have created a custom module 'one_time_popup'.I have created a sample soutput and tried to pass it and print in page.tpl.php after footer section.but doesn't shows any thing.What I did wrong.I'm a newbie

function one_time_popup_menu(){
$items['oneTimePopupData'] = array(
'title' => 'One time Popup',
'page callback' => 'one_time_popup_user_login',
'type' => MENU_CALLBACK,
'access callback' => TRUE,
);
return $items;
}
function one_time_popup_user_login(&$edit, $account){
 ...
$output='value from one time popup module!';
return theme('photo_order',array('results' => $output));
}
function one_time_popup_theme() {
 return array(
'photo_order' => array(
  'template' => 'page',
  'variables' => array(
    'results' => NULL,
  ),
 ),
 );
}

Tpl file(page.tpl)
<?php echo $results; ?>


texts: Define zone-wrapper in Omega 4 and 960px

texts:
I'm using omega 4 and i got problems. How can i define 960px in omega 4 ? should i define it in _grid.scss like this :

$grid: 12px ;
$gutters: 1/3;

$tab:44em;
$desk:77em;
$mobile:15em 35em;

If it's true , how can i have something like omega 3 zone-wrapper with 100 % width ?!!!


texts: How to sort view using already sorted array in hook_views_query_alter

texts:
I have the following code to alter a view and filter IN only specific nodes

function MYMODULE_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  if($view->id() == 'myview'){
    foreach ($query->where as &$condition_group) {
      foreach ($condition_group['conditions'] as &$condition) {
        if ($condition['field'] == "node_field_data.nid") {
          $condition = array(
            'field' => "node_field_data.nid",
            'value' => [2,4,6,1,3,5],
            'operator' => 'in',
          );
          break;
        }
      }
    }
    //this does not work
    //$query->addOrderBy('node_field_data','nid', 'ASC', '', [2,4,6,1,3,5]);
  }
}

and I want to sort them with this specific order [2,4,6,1,3,5]

I tried not putting any sorting field but the view sorts the nodes by created date.  How can I tell the view to sort them in this manner ?

I think I need to use ORDER BY FIELD('node_field_data'.'nid','2','4','6','1','3','5') in sql but I don't know how its done in drupal

I have seen this answer but don't know how it applies to my case

any help would be appreciated


texts: Access denied for anonymous users clicking on download link

texts:
I have a content type with a file field that has been formatted by display suite. I set the display suite formatter to download link.

This works fine for users who are logged in, but anonymous users get the access denied page. Is there some permission settings or file folder permission settings I need to deal with?
Accessing the raw file URL is possible for anonymous users though.

The formatter makes the link become something like this: http://example.com/file/980/download?token=OBVqG5D1va06NDH2_BcgF0vqwVhhNHsnNYcHYHGQ5_g


texts: What are the steps to be undertaken while writing a .install file for drupal 7 module?

texts:
I want to add an table to the database using .install file of a module. I am creating a completely new module which has not been enabled till now.
Which are the functions required in the .install file

function [HOOK]_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
//Should I write my query to create table inside this ...
    case 'pgsql':

   break;
}
}

function [HOOK]_uninstall() {
//Should I write the code here to remove the table after installation

}


texts: How To Add A Similar Products View To A Commerce Product Display?

texts:
On the Commerce Kickstart Product Display, I want to add a View which shows related products. I think I can figure out how to create the related products view, but I can't figure out how to add the view to the Product Display node.

Is this done by creating a TPL for the Product Type?

I tried to create a view and display that view block on the content type and nothing happens.

Suggestions?


texts: Primitive Error when saving a custom field with a text_format widget

texts:
I am trying to make a custom field with one normal textarea and 1 text_format widget.
The textarea functions perfect but if I try to use the text_format widget I get an primitve error when I am trying to save.

This is the error message:

  This value should be of the correct primitive type

This is my formElement:

 public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
  $element['date_text'] = [
  '#type' => 'text_format',
  '#title' => 'text',
  '#format' => 'full_html',
  '#default_value' => isset($items[$delta]->date_text) ? $items[$delta]->date_text : NULL,
  '#placeholder' => t('Data Text'),
  '#element_validate' => array(
      array($this, 'validate'),
    ),
];
  $element['date_table'] = [
  '#type' => 'textarea',
  '#default_value' => isset($items[$delta]->date_table) ? $items[$delta]->date_table : NULL,
  '#placeholder' => t('Data Table'),
];
return $element;

}

and this is my schema:

  public static function schema(FieldStorageDefinitionInterface $field_definition) {
$schema = [
  'columns' => [
   'date_text' => [
      'type' => 'text',
      'size' => 'medium',
    ],
    'date_table' => [
      'type' => 'text',
      'size' => 'medium',
    ],
  ],
];

return $schema;

}

It seems, that text_format returns an array instead of a single value and thus cant be saved in my text column.
The array consists of the text and the format, i dont need the format, so I would need to replace the array with the text value.

How and where could I accomplish this?

Xdebug is not working on scripts that are executed when I click save, so I really have no clue what is really going on.

thanks


texts: Is it possible to translate contents of a block with Drupal 6?

texts: I am working on a project to translate the contents of a block I created. From what I have seen I might have to use hook_menu instead of hook_block. Is this true?


texts:
Hi Im using taxonomies for categorize my products with drupal commerce, Im using "Brand" vocabulary for the products I want to display a thumbnail of the brand instead of the name of the brand in text, for use in views when showing the products in a catalog, or in the main page of the product display when editing the display of the product display...

Any idea. Thanks


texts: Starting new 8.5 site is it safe to delete and reuse field_image field

texts:
I am starting a new 8.5 website and using the core media module. I want to know if it is safe to delete the field_image field from the Article content type and replace it with a field with the same name but instead make it a media reference field. I have searched high and low and it is not clear as to if this will cause me issues with future versions of Drupal.

Thanks in advance


texts: How and where would I be able to enable/disable gzip compression?

texts: In Drupal 7 where would I be able to enable/disable gzip compression? Is there a module for this functionality?


texts:
I want to pull a JSON file out of a view that has images. This is similar to the way views_datasource works in D6.  I am not a drupal coder, but I would like to give this a try.  but I am guessing that is would be something like  http://mearra.com/blogs/juha-niemi/drupal-7-custom-node-view-modes#comment-218

but I would like to make this a module as much as possible.
any sample code, examples would be great.
thanks


texts: How do I limit a particular search result from being indexed

texts: I have a content type called "product".  This "product" has an on/off checkbox to flag whether or not the product in question is able to be viewed on the web.  I would like to index only the products that have this "web_catalog" field turned on.  I have tried using preprocess_search_result to limit the returned result to no avail.  Any ideas or suggestions would be greatly appreciated, thank you.


texts: How to implement redirect to custom 404/403 pages?

texts:
Hello Drupal community.

What I am trying to do is if error 404 or 403 occurs it redirects to a custom page instead of showing standard error message.

I tried to write “/error/404” on the “Base site settings” page and created a content with the same alias but it didn’t work.
So when I try to access a page with some random url it still shows me a standard error message but not the content with “/error/404” alias.

Is my understanding of this functionality wrong? Should I try another approach?


texts: Setting up Content Synchronization module

texts:
Blanca.Esqueda,
I'm interested in using your Content Synchronization but am having a little bit of problem getting it to run. I'm using Drupal 8 on Acquia Devdesktop, running Content Synchronization 8.x-2.0 using PHP version 7.1.12. The installation instructions is a bit cryptic to me (see image below).

Where do you put this in settings.php? I just appended it to the last lines. But then where is ../content/sync pointing to (see image below)?

After all that I'm getting:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=17&op=do_nojs&op=do
StatusText: 500 Service unavailable (with message)
ResponseText: The website encountered an unexpected error. Please try again later.
I would love to use the Content Synchronization module. Can you give me a hand on this?
Thank you very much for your help,
Kai


texts: EntityFieldQuery with "NOT IN" FieldCondition and "=" FieldCondition on the same multi-value field is only processing one FieldCondition

texts:
The EFQ is:

$query->entityCondition('entity_type', 'node')
    ->fieldCondition('field_terms_wb_access', 'tid', array_keys($children), 'NOT IN')
    ->fieldCondition('field_terms_wb_access', 'tid', $tid, '=')
    ->propertyOrderBy('title');

and the query being generated is

SELECT DISTINCT
  field_data_field_terms_wb_access0.entity_type AS entity_type,
  field_data_field_terms_wb_access0.entity_id AS entity_id,
  field_data_field_terms_wb_access0.revision_id AS revision_id,
  field_data_field_terms_wb_access0.bundle AS bundle
FROM {field_data_field_terms_wb_access}
  field_data_field_terms_wb_access0
INNER JOIN {field_data_field_terms_wb_access}
  field_data_field_terms_wb_access1
  ON field_data_field_terms_wb_access1.entity_type = field_data_field_terms_wb_access0.entity_type
  AND field_data_field_terms_wb_access1.entity_id = field_data_field_terms_wb_access0.entity_id
INNER JOIN {node} node
  ON node.nid = field_data_field_terms_wb_access0.entity_id
  WHERE  (
    field_data_field_terms_wb_access0.field_terms_wb_access_tid
    NOT IN  (
      :db_condition_placeholder_0,
      :db_condition_placeholder_1,
      :db_condition_placeholder_2,
      [...]
      :db_condition_placeholder_22
    )
  )
  AND (
    field_data_field_terms_wb_access1.field_terms_wb_access_tid = :db_condition_placeholder_23
  )
  AND (
    field_data_field_terms_wb_access0.deleted = :db_condition_placeholder_24
  )
  AND (
    field_data_field_terms_wb_access0.entity_type = :db_condition_placeholder_25
  )
  ORDER BY node.title ASC

However, why I include both fieldCondition('field_terms_wb_access', 'tid', $tid, '=') AND fieldCondition('field_terms_wb_access', 'tid', array_keys($children), 'NOT IN') clauses, it seems to only honor the first one and ignore the second. If I comment out the first one, however, then the second one is honored. I get no errors in the php error log or on the screen.


texts: Add node reference to Product field with rules

texts:
I am working on a rule to create a node based on a commerce product after it is purchased. So far I've been successful in creating the entity and filling in fields from the product fields. I am having trouble updating a field within the product to reference the node created by it's sale. I'm not receiving an error, but the product field is not updating. I've tried multiple configurations. Here's the rule exported:

{ "rules_create_projects_from_sold_instrumentals" : {
"LABEL" : "Create Projects from Sold Instrumentals",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "commerce_order", "rules_conditional", "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
  { "commerce_order_contains_product_type" : {
      "commerce_order" : [ "commerce_order" ],
      "product_type" : { "value" : { "instrumental" : "instrumental" } },
      "operator" : "\u003E=",
      "value" : "1"
    }
  }
],
"DO" : [
  { "LOOP" : {
      "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "CONDITIONAL" : [
            {
              "IF" : { "entity_has_field" : { "entity" : [ "list-item" ], "field" : "commerce_product" } },
              "DO" : [
                { "CONDITIONAL" : [
                    {
                      "IF" : { "data_is" : {
                          "data" : [ "list-item:commerce-product:type" ],
                          "value" : "instrumental"
                        }
                      },
                      "DO" : [
                        { "entity_create" : {
                            "USING" : {
                              "type" : "node",
                              "param_type" : "recording",
                              "param_title" : [ "list-item:commerce-product:title" ],
                              "param_author" : [ "commerce-order:owner" ]
                            },
                            "PROVIDE" : { "entity_created" : { "pr_created" : "PR Created By Instr Order" } }
                          }
                        },
                        { "data_set" : {
                            "data" : [ "pr-created:field-recording-cover-art" ],
                            "value" : [ "list-item:commerce-product:field-cover-art" ]
                          }
                        },
                        { "data_set" : {
                            "data" : [ "pr-created:field-pr-producer" ],
                            "value" : [ "list-item:commerce-product:field-producer" ]
                          }
                        },
                        { "entity_save" : { "data" : [ "list-item:commerce-product" ], "immediate" : "1" } },
                        { "CONDITIONAL" : [
                            {
                              "IF" : { "entity_has_field" : { "entity" : [ "list-item:commerce-product" ], "field" : "field_project" } },
                              "DO" : [
                                { "list_add" : {
                                    "list" : [ "list-item:commerce-product:field-project" ],
                                    "item" : [ "pr-created" ],
                                    "unique" : "1"
                                  }
                                },
                                { "entity_save" : { "data" : [ "list-item:commerce-product" ], "immediate" : "1" } }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  }
]

Any ideas?


texts: How can I show list of users that bookmarked article?

texts: How can I do it? I using flag module and I want to have the list of users that bookmarked article. Can I do it only with views?


texts:
I have a content type of something, with title and body only as fields, body field reporting field_body as machine name.

problem is, i create a node with content and then when it's displayed on the page, the text Body: head up the main content area, for all posts.

Tried removing the name Body from the field type name but it's a mandatory field property.

any way to rid the page of that title?


texts:
My site contains nodes which require different styles (and the occasional inline JS script) and the ability to adjust these styles through the interface rather than via code. These styles are currently implemented via a Code-only text field using <style> tags, which is not ideal. However for systemic reasons I can't place these node-specific styles in individual libraries.

How can I extract the contents of specific code-only fields and reposition this content as inline styles in the <head> of the page? I understand that this is not the preferred Drupal way, however I need a solution.


texts: How to create a single page application in Drupal?

texts:
I know Drupal and now I am creating a website by Laravel framework. I know what are single page application and how better they are. I used Angular and Backbone as JavaScript framework/library to creating a single page application with Laravel.

I am not professional in Drupal, How can I use these libraries to create a single page application (SPA) using Drupal?

Is there any module to make a (SPA) or automatically make the website Full-Ajax?


texts: How can I reference two field without nid or uid?

texts:
I have two content types: 1.- Equipment and 2.- Configuration

The First CT has the following fields:

Title : is equipment id with autocomplete module serial and hide for not capture.
model : Text
Serial : Text

The Second CT has the following fields:

Title : is conf id with autocomplete module serial and hide for not capture.
installed os : Check box (Yes|No)
App Installed : Check box (Yes|No)
Network Access : Check box (Yes|No)
Serial : Text

I need make a relationship with field serial and then create a view that shows all properties of CT two.

Regards Advanced.


texts: How to build a url to an (AJAX driven) exposed filter?

texts:
There are quite some threads about it, but none seems to do the job for me.

I'm using a better exposed filter on a view, and I'm trying to build a link that would expose the results by a query in the url.

Eg: domain.com/myview?filter=term-id

Why am I looking for this? When I use the regular approach (using Taxonomy display) it would use an url like this domain.com/myview?filter=some-stuff, and the exposed filter wouldn't work anymore but for the terms specified in the url. All the possible results are limited to what's in the url, while it should be able to filter on all the results, regardless of what's in the url.

In my console I found something like this when I'm using the exposed filters: domain.com/en/views/ajax?field_sector_tid=6

I wish I could translate that behaviour to an url. Anyone ha an idea how I can achieve this please?


texts:
I'm using the Design Module for a Drupal 7 site and have created a simple 1-column views display using the module and I want to take that template file that it has created and edit it more.

At the bottom of the layout options I am given a location of where the template should be along with the name of it, but it's not there.

Is it possible to edit a layout (template file) that Display Suite has created? Where can I find those template files?


texts: Determine whether a field has changed during hook_node_submit

texts:
Basically I need a way of checking whether a node field changed during some event hook...I am using hook_node_submit() but this doesn't seem to work:

$form['field_status']['und']['#value'] !== $node->field_status['und'][0]['value']

Produces equality all the time...any suggestions on which hook and how I would check equality when I know a value has changed it should fire off an email...

Alex


texts: Easy content management for a Views powered site

texts:
I'm building sites using Views and Panels, as you do. When handing over to the client/content editor, I want to make things as user-friendly as possible. Ideally this means they don't need to get their heads around View settings, but sometimes it seems unavoidable even for the simplest things? Or maybe I'm not designing the IA the best way...

Example: a movie review site, where each review is a node. On the homepage, we have a 'featured reviews' display with preview images for 3 movies. So I make a View that selects the 3 most recent reviews, and use some nice imageslider display or whatever. Nice.

Then the client asks if he can manually override this, and manually choose which 3 reviews to feature. He expects to just go into 'homepage settings' or something and select from a list.

So what to do... introduce him to Views filters and selecting node IDs...? Not good :(

So I resort to adding a 'featured' checkbox to the review content type, and filtering the view that way. Now this is easier for him, but still means ticking boxes on and off in various nodes. And it means I'm using content fields for something that isn't really content.

I run into this kind of situation very often, so wondered what other developers do?


texts: Conditionally display one of two fields in Display Suite?

texts:
I'm wondering if there is a clever or preferred way of using Display Suite to display one of two fields.

So my case calls for either an image, if it is uploaded, or a EVA (entity views attachment). I have them both displaying correctly, and of course if the image is not uploaded (unpopulated), then the EVA field displays fine. But if the image is uploaded, I want to hide the EVA field.

I guess I could do a custom code field, but I would like to avoid that if there is a built-in method of choosing one over another field. Maybe something with field groups?

Thanks!


texts: How to create a content type based on users with entities?

texts:
I want to create a content type that I can add to a map view based on nodes. I am using the GMap and Location modules. There doesn't seem to be an obvious way to add users to view based on nodes. So, I want to make a content type, which is a subset of the users and the fields in my user profiles. I know that I can separately have a map view based on my users, but I need to show them all together users, and 3 spatial content types.

My initial thought was just to copy the raw user data from the database and create a content type and populate it from feeds, but this would lead to a lot of duplicate data in the database.

I've created a content type with an entity reference to users. This lets me manually add content with the user name but I don't know how to share fields between the content types and I don't know how to autopopulate the content from the existing user fields.

How do I proceed?


texts: Remove or hide the submit button on search block in Drupal 7

texts:
I need to do some custom theming on the search block in Drupal 7.

Specifically, I need to add a class to the submit button that makes it invisible and removes it from the content flow.  So:

  <input type="submit" id="edit-submit" name="op" value="Search" class="form-submit">

Becomes...

  <input type="submit" id="edit-submit" name="op" value="Search" class="form-submit">

I added element-invisible to the edit-actions div element.  However, I can't figure out how to do this.  What's the best practice for doing this sort of thing?


texts: How to add class to field--item element generated by paragraphs

texts:
I have a paragraph type called "Grid Item".

I've created a file called "paragraph--grid-item--default.html.twig" where I print all my required fields.

It all works as expected, but I need to add classes (from some list fields) to the element "field--item". I can add classes in any other children of this element but on directly on it.

This is the current output I have:

This is the code I'm using in the template:

{% block paragraph %}

 {{content.field_image.0}}
            {{content.field_block_title.0}}

 {{content.field_body.0}}

     {{content. field_read_more_link.0}}

{% endblock paragraph %}

The classes content.field_block_size.0 and content.field_block_style.0 are applied as expected but I need them on the parent element...field--item


texts: How to detect which module creates session?

texts:
I am trying to achive Varnish HIT for anonymous user but get only MISSes.

It seems that my Drupal 7 site somehow starts new session for every anonymous user which opens even main page of the site. I want to detect which module makes session to start?


texts: Migrating content from one to minor version of Drupal 8 to another

texts:
Since Drupal 8 doesn't yet support beta to beta upgrade path(we might be able to upgrade from beta-12 to beta-13 but we are not sure.), has anybody tried migrating  from one minor version to drupal 8 to another version drupal 8?

We are planning to spend 3 man hour months are on a project and just trying to make sure that the efforts won't go waste in case a upgrade path wont be available by the time next beta is released.


texts: How to display value in View global text field if another field has specific value

texts:
In my scenario I'm trying to display a flag (Font Awesome icon) in Views Global Text Field if another field in the same row of a type "Date" has a value of, say, a week from now.
I tried Views Table Highlighter but it has some bugs with filters I'm using, so I thought that using the above approach would be better.


texts:
I attempted to create a pattern using Drupal Commerce 2 categories and product title.

[commerce_product:field_categories:1]/products/[commerce_product:title]

When I generate the url alias I get http://localhost:8080/diagnostics-systems/products-18.

When I generate with the pattern:

/products/[commerce_product:title]

it all comes out correct.

I set the maximum url characters generated to 255 but these done seem to even coming close. Any ideas?


texts: Can Drupal be configured to find modules in other locations?

texts:
I put my modules in sites/all/modules. Is there a way to configure Drupal to find more modules in other locations as well?

Edited

I use Virtual Hosts often but not in the way you described. The format I'm familiar with looks like this, and it helps me put the entire work project somewhere else not inside www.

<VirtualHost *:80>
    ServerName testdrupal.com
    DocumentRoot "C:/proj/testdrupal"
    ServerAlias testdrupal.com

   <Directory "C:/proj/testdrupal/">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>

I think what you're describing is something different, right? I'm trying to leave the drupal folder inside www as usual, but move only the sites/all/modules to another location, but I still can't figure out how the VHost entry will look like in this case. Let's say I want to move it to C:/proj/testdrupal. I hope I didn't completely misunderstand you.


texts: How do assign a role to user after add to cart in ubercart in drupal 7?

texts: I am using ubercart for my site.. I need to assign a role to user after shopping with price base.. If user does $300 shopping then role 10%-role . if user does $400 shopping then 20%-role etc.. And remember these role next shopping.


texts: Trying to list all articles where category field is empty

texts:
I have drupal 7 site and I'm trying to listing all articles (with title) and where category field is empty (taxonomy). I'm running this code in my page with ->isNull and without, but not any results. Can someone explain what I'm doing wrong in here and why this is not working?

$query = db_select('node', 'n')
  ->fields('n', array('nid'))
  ->condition('n.type', 'article')
  ->condition('n.status', 1)
  ->isNull('n.field_tags')
  ->range(0, 10);

  $results = $query->execute();

I'm get this error all the time:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'n.field_tags' in 'where clause': SELECT n.nid AS nid FROM {node} n
  WHERE (n.type = :db_condition_placeholder_0) AND (n.status =
  :db_condition_placeholder_1) AND (n.field_tags IS NULL ) LIMIT 10
  OFFSET 0; Array ( [:db_condition_placeholder_0] => article
  [:db_condition_placeholder_1] => 1 ) in eval() (line 17 of
  /sites/site.com/modules/php/php.module(80) : eval()'d code).


texts: How can I remove unwanted CSS found in the parent theme?

texts:
I'm working on a sub-theme of Bootstrap Barrio, which includes a table.css stylesheet. I don't want this stylesheet from the parent theme to be included in my sub-theme.

How do I eliminate a CSS file from sub-theme's parent?


texts:
My block is not showing in the blocks menu for some reason and im sure everything is correct on it, am I missing something on it?

.info file

; $Id: loans_zillow.info,v 1.0.0.0 2011/02/09 10:11:15 Jeremy Exp $
name = "Custom Zllow Module"
version = "1.0 Beta"
description = "A custom module from zillow's api"
core = "7.x"
package = "Custom Modules"

.module file

   function zillow_block_info(){
        $blocks['zillow_block'] = array(
            'info' => t('Zillow Block'),
        );
        return $blocks;
    }

    function zillow_block_view($delta = ''){
        $block = array();
        switch ($delta){
            case 'zillow_block';
            $block['subject'] = t('Zillow Block');
            $block['content'] = zillow_content();
            break;
        }
        return $block;
    }

    function zillow_content(){
        return'

this is a test

        ';
    }


texts: How to filter paragraphs by the field name on parent using entityQuery?

texts:
I have a paragraph type my_paragraph which is attached to a node type my_content_type on multiple fields like field_a, field_b, field_c, field_d. I want to load only those attached to some specific fields, let's say field_a and field_c. I am using entityQuery, but open to other suggestions.
The entity/field structure is like:
my_content_type: Node
|_ field_a: Paragraph (type: my_paragraph)
|_ field_b: Paragraph (type: my_paragraph)
|_ field_c: Paragraph (type: my_paragraph)
|_ field_d: Paragraph (type: my_paragraph)

My code which loads all paragraphs of type:
\Drupal::entityQuery('paragraph')
  ->condition('type', 'my_paragraph')
  // Here I want to filter by the field name on the parent entity
  ->condition('PARENT_FIELD', ['field_a', 'field_c'], 'IN')
  // Some more conditions out of context
  ->condition('out_of_context_field', $out_of_context_value)
  ->execute();

Is there any entity query condition I can use here?


texts: Image upload in a node gives required error

texts:
we have a node to which we upload many pictures. This time, after ~ 337 pictures all of the following pictures are marked as failure with an error but as message is just given "Field Bilder is required". Bilder (translates to images) is the field we already uploaded 300+ images.

In the recent Drupal log is no message concerning upload errors. Any clues what could cause this problem?


texts:
Is there a commonly accepted "best practice" for how to use the "Main Menu" vs the "Navigation Menu"? The descriptions in Core add to my confusion:

"The Main menu is used on many sites to show the major sections of the site, often in a top navigation bar."

vs

"The Navigation menu contains links intended for site visitors. Links are added to the Navigation menu automatically by some modules."

I don't intend to start a debate. I'm curious if there's a best practice for how to use these, or is it entirely subjective?


texts: Why date field is picking the user's timezone?

texts:
I have a date field with default value set to now. I have selected the site's timezone in the date field settings.

So for every user the date field value should be according to the site's timezone. But on node forms I can see the date field value is different for every user according to the timezone set on that user profile form.

Why the field value is not according to the site's timezone. it should be same for all the users.

If I disable this settings Users may set their own time zone in the regional settings then every thing works fine.

Is there any configuration I'm missing?


texts: problem with print of “Ubercart CCK Checkout Pane” modules

texts:
in ubercart, I'm using Ubercart CCK Checkout Pane module, for adding fields to the Order. Now I have a problem. When I get a print order, cck fields are not in print.

What should I do?


texts: How do I get the taxonomy term's path alias?

texts:
I have come up with a need to show a node term's URL alias using plain php in drupal 8 but I can't figure out how to do it.
In my custom module, I want to get /fruits/apples in a variable upon loading a node which is linked with Fruits term.

Here you can see the Edit Term settings page in which I have set the URL alias of the term Fruits to /fruits/apples. I want to get this URL alias whenever a user loads a page linked to this term.


texts: Is there any way to show a progress bar during loop iteration in a rules?

texts:
I have made a rule set and in my rules I load a collection of nodes into a list and by iterating, I perform some modifications in each node.

Sometimes the number of nodes is more than 500.

I want to know is there any solution in order to show a progress bar during loop processing ?(such as one when we update a module)


texts: Refresh Image Style in Drupal Commerce on Add To Cart Attributes Refresh (D7)

texts:
I'm building a t-shirt website, and I'm looking into having the customer be able to choose certain shirt attributes such as hoodie/t-shirt, shirt color, etc.

Using imagecache actions, I've looked into setting up a separate image style for each variation type (such as black hoodie) which then renders the shirt design onto a template for a black hoodie. I've gotten this to work as individual image styles. I've looked into the solution proposed here (in the second answer) to create an image style called 'clothing' that then runs a 'custom action' image effect to determine the image style to actually render. Using the code in the linked answer, I was able to modify it to do a check on:

$image_context['entity']

and grab the tid of the attribute (such as shirt color) and then run a taxonomy_term_load to check the attribute name.

I've gotten this to work (tentatively), and I can handle the base-level PHP to do the comparing and logic to check the attributes. The problem that I'm having is that when I change an attribute (such as shirt color), the $image_context['entity'] object is not updated and/or the image style is not re-rendered.

How can I cause the image style to be re-processed when a user changes an attribute on the add to cart form? I know little on this, but I've read that I could possibly us a custom module and hook_commerce_cart_attributes_refresh_alter.

I don't know much about the syntax of this function, and I don't know how to trigger a change to the $image_context['entity'] object and/or refresh the image style. In a worst-case-scenario, I would even be willing to change the value of the object and reload the page, but this would not be ideal.

Can I just dpm the values from inside hook_commerce_cart_attributes_refresh_alter and grab the new values, and set them accordingly inside $image_context['entity']? i.e. would the image style automatically be re-triggered because the new product image would be grabbed?

Is this possible?


texts: Why do I need to remove old files first when upgrading Drupal or its modules?

texts:
I'm in the process of updating my Drupal version 7.41 to 7.43 and started o follow the guide Update procedure (minor version change) where it says

  Remove all old core files and directories, except for the 'sites' directory, the original install profile in the 'profiles' directory and any custom files you added elsewhere.

and I was wondering why they wanted to have me erasing everything first, can't I just copy all the new content into my ftp folder except the sites/ directory?

Thanks


texts: How to correct html code for apostrophe appearing in Views contextual filter select list?

texts:
I am finding that taxonomy terms containing an apostrophe are not rendered correctly when seen in a Views contextual filter select list.

I am working on as school website and Parent's Evening is displayed as Parent&#039;s evening

How to correct this?


texts:
I want do show/hide menu items based on a checkbox that the user selects when he/she registers.

I use profile2 for register.  Should I use an external jquery script that calls on page load or should I use a hook_menu_alter() in my template file?  I am not too familiar with Drupal code yet and appreciate any input.


texts: How to theme a preprocess function output with a default, without the need of a .tpl file?

texts:
I created this simple function in order to print out the commerce order author UID and email.

How may I add the output of the function inside the messages area, without creating a special .tpl? I want that information to be in a special place regardless of the theme implementation.

This is the preprocess function (the only way I manage to get to know if I was inside an order)

function MYMODULE_preprocess_page(&$variables) {
    //si estamos dentro de la orden, lo sabemos sólo en función del link en el que estamos!
    $uri = request_uri();
    $find = '/admin/commerce/orders/';
    $pos = strpos($uri, $find);
    if ($pos !== false){
        //usando if (commerce_order_type_get_name($type = 'order')) no andaba
        //obtenemos el número de orden: obtenemos el link con request_uri()
        //y de ahí lo explotamos en un array. Sabemos que el número será siempre
        //la última parte del link (4).
        //usamos commerce_order_load('id de la orden') para obtener el usuario que la completó
        $uri = request_uri();
        $partes = explode('/', $uri);
        $usuario = commerce_order_load($partes[4])->uid;
        $correo = commerce_order_load($partes[4])->mail;
        $estado = commerce_order_load($partes[4])->status;
        echo "
".$correo." (".$estado.")
";

    }

}

As you can see, I've tried with this horrible:

echo "
".$correo." (".$estado.")
";

Even when the classes are the same as the rest of the drupal messages, the output keeps appearing at the very top of the page.

How may I do it the right way? (Maybe it necessarily involves template.tpl file?)


texts:
I'm using the following code just to see if the paging works in Drupal 7, but I'm having trouble to set it to work.

$query = db_select('node', 'n')
  ->fields('n', array('nid', 'title'))
  ->extend('PagerDefault')
  ->limit(5);

$headers = array(t('node'), t('Title'));
$rows = array();
$result = $query->execute();

foreach ($result as $record) {
  $rows[] .= array($record->nid, $record->title);
}

$output = theme('table', $headers, $rows);
return $output . theme('pager');

I'm not so good with PHP, so can someone please tell me what am I doing wrong?


texts: how can I override theme_image() on a custom node template, only

texts:
Can anyone explain how to override theme_image() but only on a specific custom node template? (i.e. node--artist-page.tpl.php)

As I understand you shouldn't put things like theme_image() in a .tpl file, but the theme devel module it's not offering up any candidate function name overrides except mythemename_image(), which would apply to all images on all pages.


texts: How to store information in session for anonymous user in a site without a user with uid=0?

texts:
In our system for some reason, we have deleted user with 0 uid. But for now I have to store some information in session for anonymous users. But Drupal is not allowing me to save the information in session.

Can someone suggest another way around?

I am trying

  session_start();

  $_SESSION['some_param'] = 'value';

for retrieving

  session_start();

  echo $_SESSION['some_param'];

But the values are not available after reload.

PS: It is working fine if I create a user with uid=0. But I need solution without uid=0.


texts: Display a View Block multiple times in a region with each view using a different filter

texts:
Here's a visual representation of what I wanted to happen.

<my-region>

    <article-list-view filter=article-type-1 />

    <article-list-view filter=article-type-2 />

    <article-list-view filter=article-type-3 />

</my-region>

Now I can actually just go ahead and create a separate region and a separate view block for each type of filter but it doesn't look like good design since It's going to be repetitive.

Is my goal doable? If not, what's the common approach to accomplish this task?


texts:
I have a view which is a HTML list of the most popular tags in a specific vocabulary it is displayed as a block on a page of most recent news items. It is also displayed on each individual news item.

When it is displayed on the individual news item page I would like any tag that the news item has been tagged with and that also appears in the popular tags block to be highlighted by adding a css class called active.

How would I achieve this?


texts:
Does "Calender System" only works with "content types " ? The date popup options does not show while adding a "date" type field in to a webform node .

https://drupal.org/project/calendar_systems
https://drupal.org/project/webform

Date Field properties in a content type .

Date field properties in a webform node .

Any clue ?
thanks :)


texts: Does Drupal 7 use a publicly-available function to concatenate text in the "text area with summary" widget?

texts: I'd like to make use of functionality similar to the "display summary if filled in, if not display shortened body" that is used by Drupal's text area with summary widget. Is there a publicly available function that will concatenate body text to a certain word length, taking into account that there may be embedded HTML?


texts:
I am using Drupal 7 and bootstrap theme, I also have installed jquery update module,

Now I have created a js (jquery) file and saved it under js folder in bootstrap theme, I tried to call my js file in the info file using script[] = '...', the console then suggested  that '$ is not a function', which means my js file was called before jquery was called.

Then I decided to call the my js file from template.php:

function bootstrap_preprocess_html(&$variables) {
  $options = array(
    'group' => JS_THEME,
  );
  drupal_add_js(drupal_get_path('theme', 'bootstrap'). 'js/product_pages.js', $options);
}

then the following line showed up in the console:

GET http://localhost/Brompton/sites/all/themes/bootstrapjs/product_pages.js?mpprnf 404 (Not Found)

I am confused, how exactly can I get jquery work properly here?


texts:
I am using this, but I don't understand why it's not working.

if ($_SERVER['REQUEST_URI'] == '/node/1') {
  drupal_add_js(drupal_get_path('theme', 'sanskrit').'/sites/all/themes/sanskrit/scripts/jquery-1.4.3.min.js', 'inline');
  drupal_add_js('/sites/all/themes/sanskrit/scripts/scripts/jquery.nivo.slider.pack.js');
}

What I want to do is adding specific JavaScript files when the user is viewing the front page.


texts:
I've got a Drupal 8 webform with a multi page wizard. I know that it is possible to "jump" to a specific page if I implement hook_webform_submission_form_alter() and add my own submit function to change the formState current_page to my desired page. But I want to check a value from a previous page and if the value is value_a I want to submit the form. If it is value_b I want to go to page b and if its value_c I want to go to page c.

$pages = $formState->get('pages');

if ($formState->get('type') === 'value_b') {
    $pageName = 'page_b';
    gotoStep($pageName, $pages, $formState); // this is my custom function to go to the desired page
} else if ($formState->get('type') === 'value_c') {
    $pageName = 'page_c';
    gotoStep($pageName, $pages, $formState); // this is my custom function to go to the desired page
} else {
    // SUBMIT FORM. HOW TO DO THIS?
}


texts: How can I do the dynamic select in Drupal 7 forms?

texts:
In the following code I call the function players() which returns array of values for option. This values were defined beforehand by hand. How can I load it dynamically from the database?

 $form['officers']['officer'] = array(
'#title' => t('Select the officer'),
'#type' => 'select',
'#description' => t('Please, select the officer'),
'#options' => players(),
'#multiple' => FALSE,
'#empty_value' => ' ',
'#empty_option' => '- None -',

);

For example in the "Text Field"  there is property #autocomplete which defines a path where Drupal’s automatically included JavaScript will send HTTP requests using jQuery.

 $form['team_name'] = array(
'#title' => t('Name'),
'#type' => 'textfield',
'#description' => t('Please, insert your name'),
'#autocomplete_path' => 'autofillform/teamname' ,

);
And i created the module which handles it.

<?php
function autofillform_menu() {
$items['autofillform/teamname'] = array(
'title' => 'Example autocomplete',
'page callback' => 'autofillform_teamname',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
 );
 return $items;
 }
 function autofillform_teamname($string){
 $matches = array();
 $result = db_query("SELECT name FROM users where lower(name) like '".$string."%'  LIMIT 10");
 foreach ($result as $user) {
 $matches[$user->name] = check_plain($user->name);
  }
 print drupal_json_encode($matches);
 return;
 }

Are there any possibility to do the same with "Select" ?


texts: Using forms and templates and _submit callback

texts:
I'm trying to wrap my head around the process of creating a form and handling the submitted data using x_submit().

I start by having a form callback:

function world_form(&$form_state) {

  // if ($form_state['post']) { drupal_set_message("Solved!"); }

  $forms['fieldset_options'] =
    array('#type' => 'fieldset',
          '#title' => t('Options'),
          '#collapsible' => FALSE,
          '#collapsed' => FALSE);

  $forms['fieldset_options']['tags'] =
    array('#type' => 'item', '#title' => 'Simple stuff');

  $forms['fieldset_options']['checkbox1'] =
    array('#type' => 'checkbox', '#title' => t('Solve world problems'));

  $forms['fieldset_options']['submit'] =
    array('#type' => 'button', '#button_type' => 'submit', '#value' => 'Go!');

  // $forms['submit'] = array('#type' => 'submit', '#value' => 'Go!');

  return $forms;
}

So I specify a theme callback, which takes me to a file world.tpl.php in which I do:

print drupal_get_form('world_form');

which invokes my form callback. So far so good. Now the problem I have is that I want to handle when this form is submitted (more specifically, I want the value of the checkbox when it is checked). I read a lot of documentation and most mention the world_form_submit function. So I create one like this:

function world_form_submit($form, &$form_state) {
  drupal_set_message("Posted!");
}

But after I've done that the function isn't called. However if I instead use the line which is commented out in my form function and comment out the '#type' => 'button' field it DOES get called and I can now access the checkbox state, however the problem I have now is that the form is not updated with the state of the checkbox (I.e. if I check the box and submit I get to the same page but the box is no longer checked).

So my questions are:

Why isn't the _submit callback called when I use a "regular" submit button? Do I have to use the $forms['submit'] way?
If I do get the _submit callback called, can I still update my form to reflect what it was before I submitted, and
How can I get the checkbox state in my world.tpl.php file? Say I want to print something if it is checked.

Thank you for your time.


texts: Alter a view so it adds a custom field ->textbox

texts:
I have a bit specific question.

I have a content type->TESTS
it has the more or less the normal fields.

There is a view that displays all of the tests. So far,so good.

But the requirement is to add a specific textbox-> SCORE of TEST for every instance.

And it should be different for all the logged in users.

For example. All users see the tests and can insert a result.
This result is recorded in the database.

What should be the best approach doing so ?

Maybe:
1.Create the field "ScoreOfTest"
2.Alter the view in a custom module

Thanks in advance


texts: Drupal 7: How to insert site's Main Menu and also use my custom style on it?

texts:
I've a menu like this-

About Us

Artists

Works

Dolore ipsu

Consecte

Dolore ipsu

Consecte

Elit Conseq

Elit Conseq

Blog

Contacts

There's a whole section of CSS style information for that plain HTML section.
I've tried to add the site's Main Menu to page.tpl but it isn't showing up When I add the following PHP code-

<?php
    $menu = menu_navigation_links('menu-main-page');
    print theme('links__menu_main_page', array('links' => $menu));
?>

What am I doing wrong here?

Also when it DOES show up, I'd like to which elements are printed exactly when trying to include the menu and how to assign the generated ul / li to some classes, as required for the CSS to apply style to those elements?


texts: How to keep the non mapped paragraphs during migrations?

texts:
I am migrating content that contains paragraphs also. So I have two migration files.
When the content is migrated. Everything is fine. I can see the paragraphs are attached with the nodes.
When I edit a migrated node and adds a new paragraph to the node, then when I execute the migration again, that new paragraph removes from that node. Is there any way to keep them?
The paragraph_import.yml
langcode: en
status: true
id: paragraph_import
label: My paragraph import
migration_tags:
  - paragraph
source:
  plugin: csv
  delimiter: ','
  enclosure: '"'
  escape: '`'
  header_offset: 0
  ids: ['personal_number']
destination:
  plugin: 'entity_reference_revisions:paragraph'
  default_bundle: my_paragraph
process:
  mail:
    - plugin: skip_on_empty
      method: process
      source: 'e-mail werk'
  cellphone:
    - plugin: skip_on_empty
      method: process
      source: 'gsm werk'
  phone:
    - plugin: skip_on_empty
      method: process
      source: telefoon
  langcode:
    - plugin: default_value
      default_value: 'nl'
dependencies:
  enforced:
    module:
      - migrate_source_csv

The node migration.
langcode: en
status: true
id: contact_import
label: Contacts
migration_tags:
  - node
source:
  plugin: csv
  delimiter: ','
  enclosure: '"'
  escape: '`'
  header_offset: 0
  ids: ['personal_number']
destination:
  plugin: 'entity:node'
  default_bundle: contact
process:
  type:
    plugin: default_value
    default_value: contact
  title: title
  paragraph:
    - plugin: migration_lookup
      migration: paragraph_import
      source: personal_number
  my_paragraph_field:
    - plugin: sub_process
      source:
        - '@paragraph'
      process:
        target_id: '0'
        target_revision_id: '1'
  langcode:
    - plugin: default_value
      default_value: 'nl'
dependencies:
  enforced:
    module:
      - migrate_source_csv

My migration execute code.
$migration = $this->migrationPluginManager->createInstance($migration_id);
$migration->getIdMap()->prepareUpdate();
 try {
   $executable = new MigrateExecutable($migration, new MigrateMessage());
   $executable->import();
 }
 catch (MigrateException $exception) {
   $this->logger->error($exception->getMessage());
 }

It is different from this question Because that question talks about the fields in the paragraph. While this question is about the paragraph entity itself.


texts:
I have one product with 5 variations

book:
paperback, hard cover; audio; ebook(epub, mobi)

How do i display the individual prices per item on node


texts: How to create username with firstname and lastname using feeds and tamper?

texts:
On Feeds tamper module page (amazing module btw), it says that the module permits to [...]

Examples:
[...]

  Combine separate 'firstname' and 'lastname' fields into one 'name'
  field.

But I don't find any documentation on how to do this. Any help?


texts:
I'm currently using the default calendar views "Upcoming" block to display upcoming events on my homepage. However, because events are infrequent, its common for there to be no upcoming events. In which case, the block disappears and leaves a big blank spot in the home page.

Is there way to show either the next four events OR the last four events? For example, if there is only one upcoming event, it would add the last three events to the list and display all four in ascending order.

Thanks!