texts:
I have two flags defined in my site (false_negative_flag and false_negative_flag_passed). Each flag has different Flag link text.

In views, I have two displays. I have a flag link in each of these views, one with the first flag, the other with the second one. The link text shows correctly on both displays. I wanted to have images instead of the link text so I added the following css:

.flag-wrapper.{false_negative_flag} a.flag-action {
    background: url(http://.../files/failed.png) no-repeat center center;
    border:none;
    width: 18px;
    height: 18px;
    margin-left: 0px;
    float: left;
    color: transparent;
    text-indent:-9999em;
}
.flag-wrapper.{false_negative_flag} a.unflag-action {
    background: url(http://.../files/passed.png) no-repeat center center;
    border:none;
    width: 18px;
    height: 18px;
    margin-left: 0px;
    float: left;
    color: transparent;
    text-indent:-9999em;
}
.flag-wrapper.{false_negative_flag_passed} a.flag-action {
    background: url(http://.../files/passed.png) no-repeat center center;
    border:none;
    width: 18px;
    height: 18px;
    margin-left: 0px;
    float: left;
    color: transparent;
    text-indent:-9999em;
}
.flag-wrapper.{false_negative_flag_passed} a.unflag-action {
    background: url(http://.../files/warning.png) no-repeat center center;
    border:none;
    width: 18px;
    height: 18px;
    margin-left: 0px;
    float: left;
    color: transparent;
    text-indent:-9999em;
}

There are 3 different images I use but in my views I always see the passed and warning ones (the last two entries of the css). Is there any error in my css?

NOTE: I'm using the displays in Panels, don't know if it's relevant.

EDIT after first answer: I got the css I'm using from the link in this answer. I simply duplicated and in the second part I added the second flag machine name. The problem is that now it ignores the first two blocks of the css.

Thanks!


texts: How to order views by taxonomy term name?

texts:
for some reason the sort criteria by taxonomy term field do not work properly.

This is the view:

Here you can see the field I order by.
The options of the field is the default. Only one taxonomy term per node.

And this is the result:

As you can see the '2005' node is at the end and not a the start of the view's result.
I have no idea why this happened.
I tryed to delete the node and create a new one, delete the taxonomy term and recreate this but nothing happned.

Can someone help me to understand what is happening? I do not want to add queue module and order the view by queue order..

NEWS

SELECT ... ORDER BY field_data_field_edizione_field_edizione_tid ASC
The view order by tid and not by weight T___T
Now I understand what is the problem.. how can I create a new views sort criteria?


texts:
I try to make my first views template. I need following for a image gallery based on ZURB Foundation 3 Clearing.

I created a view with list
 in Drupal 7 but i need the HTML structure above. At the moment i have only the result with normal

 Image Display.

The machine name is "gallery". I know how i can create views, override the template but the problem is, i don't know the PHP Variables for this.

I need the tags data-caption="Maecenas sed diam eget risus varius blandit sit amet non magna." and to format the html list like the example above.

For more information about this: http://foundation.zurb.com/docs/clearing.php#clearingCode


texts: How to show book information in search result page

texts:
I want to show some extra book information in the search result page like node id, book id, book name etc.
I have added some code in search-result.tpl.php but its still not showing.

$node->book['bid']  //is added to show book id.
$node->node['nid'] //is added to show node id.

Let me know where i am doing wrong.


texts: How to add data attributes to view list  tags?

texts: I have a HTML-list view, which generates li tags for my content. I want to add a data- attribute to each list item dependent on the content. How to achieve this?


texts: How can we achieve multiple forms in a single page?

texts:
I have menu callback which is getting called multiple times on the same page by an AJAX request resulting rendering the form with same HTML id

$items['mymodule/page'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array('page_callback_form'),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

function page_callback_form($form, &$form_state, $thing) {
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#cols' => 80,
    '#rows' => 5,
  );
  return $form;
}

Result:  <textarea id="edit-message" name="message" cols="80" rows="5" class="form-textarea"></textarea>
<textarea id="edit-message" name="message" cols="80" rows="5" class="form-textarea"></textarea>

i was wondering is there a way i can have unique Ids, i have tried [hook_forms].1


texts: User can't access own private files via Views

texts:
I've set up a private directory sites/default/files/private and use it for a file field.

As an admin, everything works as expected when uploading and viewing a private file.

As a user who uploads a private file, I can only download own private files with the Views formatter Download link (example.com/file/585/download?token=TcBjzT2I), but not view them via Generic file (example.com/system/files/private/mypic.jpg) or other formatters. When using the latter, I get

"Access Denied
You are not authorized to access this page."

Permission "View own private files" for role enabled. Even enabling "View private files" has no effect.

What am I missing?


texts: My module's custom fields are not picked up by entity_metadata_wrapper and thus Rules

texts:
The problem I have is that I am using a module called Trackfield that defined a CCK field for D6, I (inexpertly) ported the module to D7 to use the Field API. My port works great and I have been using it for over a year but I have recently wanted to set one of its values in Rules, but it isn't available in Rules. There are several other field types provided by this module and my port that also work fine but are not available in Rules.

I have tried setting conditions in the rules for 'entity type' and 'entity has field' to no avail. The field is listed for 'entity has field' but is not available as a data selector.

I have used the entity_metadata_wrapper() to test entities with a field provided by my module (field_foo) and the EMW does not see the field at $wrapper->field_foo but it is present on the node object at $wrapper->value(). All other field types on these entities are available as you would expect on the EMW object and as data selectors in rules, these include date, file, entity reference.

I have got to the point where I figure, seeing as all the fields provided by my module are not picked by the EMW, I must have missed declaring something through the field API that would allow my fields to be picked up automatically or that I have included some bad configuration somewhere that causes them to be discarded.

Thanks in advance for you time and thoughts, it is all very much appreciated.


texts: Theme overrides for custom hook_theme() in Drupal 7

texts:
I have a custom D7 module which defines it's own hook_theme() which defines a few theme functions, of which they define their own template, for example:

function foo_theme($existing, $type, $theme, $path) {
    $items = array(
        'post_foot' => array(
            'template' => 'templates/post_foot',
            'variables' => array('node' => (object)array())
        )
    );
    return $items;
}

As you can see, it defines it's own template, which is located in the foo module, in this specific case sites/all/modules/custom/foo/templates/post_foot.tpl.php

I'd like to be able to define my own post_foot.tpl.php in my theme, and use foo's tpl as a fallback.

Does this happen automagically? Do I need to expand my hook_theme() to include overrides?


texts: How do I use AND condition in Rules to add shipping to sales tax?

texts:
The default sales tax Component Rule calculates sales tax on all line items... so it was (for us) correctly adding sales tax to products and shipping line items. We started using Userpoints_Discount and I created a new Product Type 'Points' to allow users to purchase Userpoints. I then edited the Component Rule as below. So now, it calculates Sales Tax on the product which are NOT 'Points' (good) but it has stopped calculating sales tax on shipping (bad).

Can someone look at this Component Rule and explain why the Shipping Line Item is no longer having sales tax calculated?

The logic should be:

IF Commerce Line Item IS IN bundle Products OR bundle Shipping
  AND Commerce Line Item Product Type IS NOT 'Points'

I am using Commerce Kickstart 2.

{ "commerce_tax_rate_state_of_washington" : {
    "LABEL" : "Calculate State Of Washington 9.5%",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "TAGS" : [ "Commerce Tax", "sales_tax" ],
    "REQUIRES" : [ "rules", "inline_conditions", "commerce_tax" ],
    "USES VARIABLES" : { "commerce_line_item" : { "label" : "Line item", "type" : "commerce_line_item" } },
    "IF" : [
      { "AND" : [
          { "entity_is_of_bundle" : {
              "entity" : [ "commerce-line-item" ],
              "type" : "commerce_line_item",
              "bundle" : { "value" : { "product" : "product", "shipping" : "shipping" } }
            }
          },
          { "NOT commerce_product_has_type" : { "commerce_line_item" : [ "commerce_line_item" ], "type" : "points" } }
        ]
      }
    ],
    "DO" : [
      { "commerce_tax_rate_apply" : {
          "USING" : {
            "commerce_line_item" : [ "commerce-line-item" ],
            "tax_rate_name" : "state_of_washington"
          },
          "PROVIDE" : { "applied_tax" : { "applied_tax" : "Applied tax" } }
        }
      }
    ]
  }
}


texts: Never show the term name if the user has no permission to view the term

texts:
I use a vocabulary to freetag bookmarks I post to my site, and I want to hide all the terms (also most nodes; most or all, I don't care).

With TAC module I use following setting for a start:

global default: Show/Create/Delete: ignore   Show-term-checkbox: yes
myvoc default:  Show(node) : disallow;       Show-term-checkbox: no

I have also tried with:

global default: Show/Create/Delete: ignore   Show-term-checkbox: no

I just want to make Drupal show the "access denied" or similar page on /taxonomy/term/xxx. I know my site doesn't show a link with that URL, but I just want to be sure.

Is it possible? Or should I use a simpler module?


texts: How to add a slideshow inside a node with Slick?

texts:
I created a Content Type with an Image Field that could take multiples images.
I would like to display a slideshow of these images.
So for each node of this Content Type, I would have a different slideshow, directly inside the node.
On Drupal 7, there is the Field Slideshow module that seems to do that, but I'm on Drupal 8.

So I installed Slick Carousel and Slick Extras so I can use the formatter called Slick Image for my multiple images field.
But there are many options and I can't find the correct ones to have the slideshow working.

Here are the options :

Can anyone give me the right options ?


texts: Provide autocomplete field with user's Display Name

texts:
Drupal core already supports autocompletion of username fields. However is there a way to provide autocomplete for user's Display Name? Since this is a virtual field, a database query with % like cannot be performed.
One way I could think of accomplish this would be to save display name for each user in the user_data table, and set this storage with an event subscriber that reacts on account creation and account update. Once this field is available, it could then be used with database queries for autocomplete.
Interested to know if there is another way to do this.


texts: How to add Properties to an Entity in code?

texts:
With Drupal (v7.22) I'm using the Entity Construction Kit (ECK) module (v7.x-2.0-rc2) and want to extend the sub module called 'ECK Example' that comes with it. Currently the example module just creates an Entity using code but doesn't include any default properties like Title, Author, Changed etc. This is the current module code:

$entity_type = new EntityType();
$entity_type->name = "eck_employee";
$entity_type->label = "Employee";
$entity_type->addProperty('name', 'Name', 'text');
$entity_type->save();

How can I enable the default properties for the Entity?


texts:
I have a problem that looks relatively simple.

An activity entity has multiple invitation entities, the reference is from the invitation.activity_id => activity.

Invitation has a completion_date (when the user completes the activity) which can be zero (not complete) or a timestamp of when it was completed.

(I created a reverse relationship so I can go from the activity to the invitations, that works fine.)

I want to create a table view where each row is an activity, and it has two columns - total invitations and completed invitations.

The total is easy: switch on aggregation and count the number of invitations.

Calculating the number of completed is another matter.

I've created my own views field plugin (extended from boolean) which inserts an expression field instead of using the actual field.

class InvitationCompletionState extends Boolean {
  /**
   * Called to add the field to a query.
   */
  public function query() {
    $table_alias = $this->ensureMyTable();
    $this->query->addField(
      NULL,
      "IF($table_alias.completion_date > 0, 1, 0)",
      'completion_state'
    );
  }

But I can't aggregate it. I know aggregation doesn't work with everything, and I suppose this is a situation where it doesn't.

I wanted to use the boolean option (although INT might be better) because I can count the number of completed by simply SUMming the results.

This is the Views query if I try to use the aggregation

SELECT activity.name AS activity_name, activity.type AS activity_type, activity.start_date AS activity_start_date, activity.end_date AS activity_end_date, activity.estimated_time AS activity_estimated_time, COUNT(invitation_activity.id) AS invitation_activity_id, SUM(invitation_activity.completion_date) AS invitation_activity_completion_date, MIN(activity.id) AS id, MIN(invitation_activity.id) AS invitation_activity_id_1
FROM {activity} activity
LEFT JOIN {invitation} invitation_activity ON activity.id = invitation_activity.activity
GROUP BY activity_name, activity_type, activity_start_date, activity_end_date, activity_estimated_time
ORDER BY activity_start_date DESC

And it just forgets about inserting the expression.

Further investigation:

Pasting the following code into Workbench works and gives me the answer I want:

SELECT
    activity.name AS activity_name,
    activity.type AS activity_type,
    activity.start_date AS activity_start_date,
    activity.end_date AS activity_end_date,
    activity.estimated_time AS activity_estimated_time,
    COUNT(invitation_activity.id) AS invitation_activity_id,
    SUM(IF(invitation_activity.completion_date > 0, 1, 0)) AS completion_state,
    MIN(activity.id) AS id,
    MIN(invitation_activity.id) AS invitation_activity_id_1

FROM activity activity

LEFT JOIN invitation invitation_activity ON activity.id = invitation_activity.activity

GROUP BY activity_name, activity_type, activity_start_date, activity_end_date, activity_estimated_time

ORDER BY activity_start_date DESC

which means that MySQL can handle the code, it's just that Views does not know how to generate it.

I need to be able to make this work in a standalone handler (for any future devs), writing a hook to modify a query is not really an option.

Any thoughts?


texts:
I can do this directly in MySQL ...

GEOID + '-' + NAME IN ('01005-Barbour', '01007-Bibb')

But when I try to do this using the database API ...

$query->condition("s.STUSPS + '-' + c.NAME", $counties, 'IN');

I get an error and it looks like it strips out the concatenation ...

"WHERE s.STUSPSc.NAME IN (..."

How can I make this work? Thanks!

EDIT: I tried this as well, but it never processed ... like it was stuck in a loop or something.

foreach ($counties as $county) {
  $cArr = explode('-', $county);
  $andCondition = $query->andConditionGroup()
    ->condition('s.STUSPS', trim($cArr[0]))
    ->condition('c.NAME', trim($cArr[1]));
  $query->orConditionGroup()->condition($andCondition);
}

A fix for either way would help. Thanks!


texts: How to attach/upload a file to node using restws?

texts:
I've got a content type with "File" field and "File" widget. I am successfully able to create a node without a file using restws. But, if I want to attach a file to it, it just doesn't allow me to do that. I've tried many different things, but with failure.

Also, when accessing a node with file already attached to it, using get request (e.g. {domain_name}/node/219.json), the file field is displayed as an empty element, even though file is existing and is displayed fine when viewing the node in edit mode from admin area.

E.g.

JSON:

"field_simple_file":[]

XML:

<field_simple_file/>

The node array without file field, that succeeds is as below:

$new_node = array(
    'body' => array(),
    'type' => 'simple',
    'title' => 'Content created with restws',
    'language' => 'und',
    'status' => 1,
    'promote' => 0,
    'sticky' => 0,
    'author' => 1
);

And content-type:

'Content-Type: application/json'

But I think, I am not 100% sure on how to include a file in it (have tried few different things), which might be leading to failure. Can anyone provide me with guidance for attaching/uploading a file with restws please?


texts:
Can we show the result summary like "Displaying X to Y of Z records" while using the "table" or "tableselect" themes? I mean just the thing we do in views header/footer using the "Global: Result summary" option.

Hope I am clear with the requirement.


texts: Product Supplier Sales (relational) database

texts:
I've got the following information to store:

SalesChannel F --- ( Price D ) --- Product A --- (Price X) --- Supplier V

SalesChannel G --- ( Price E ) --- Product A --- (Price Y) --- Supplier W

I first tried it with commerce and variations. But I can't setup the price information on one relationship.

Then I tried the Relation module which can do this but when displaying it, I'll get duplicates (product A 4 times and then the combinations).

Entity Relation won't help as well since I can't store the price information there (it's either at the product or at the supplier for instance).

The last shot was EVA and trying to attach a view to the products but it seems as if it won't work together with Relation so I can't use this as well (or did I just fail to find appropriate documentation?).

What can I do here? Any ideas?
I'd not like to simply add several supplier fields and price fields to the product since I'd break up the structure. :-S

Thanks,
Chris


texts: Image style, reuse image in field collection item

texts:
I've got some problems with the image styles, when reusing an image in a field collection, because the new size of the former uploaded image is not generated altough the path to the imagefile is shown in the right way.

Uploading a new image within the field collection, everything works fine and the image shows up. Only reusing an already uploaded images crashes and only within the field collection, reusing images in other fields works fine.

Anyone may has the same problem and an idea, how to solve this?


texts: How to make a node sticky only in a given Taxonomy Term?

texts:
Content Type: Book (with Field: Term Reference->Subject)

Hierarchical Taxonomy: Subjects

Science
--Chemistry
--Maths
--Biology
Engineering
--Civil
--Electrical

When I create a node (Intro to Maths) I mark them under taxonomy terms relevant to the subject(Chemistry, Maths, Civil, Electrical).

Now I use Nice Taxonomy Menu to display a collapsible list of taxonomy terms in the sidebar. When a user clicks on a taxonomy term they will see a list of books in alphabetical order, categorized under that subject.

But for some nodes (Intro to Maths) are more important to one subject than others. So for tax term Maths, Intro to Maths should display at the top of the list (disregarding the alphabetical order).

I tried marking the nodes with Sticky at top of lists, but that will place that node at the top of the list in every subject it's associated with it. I don't want that. I just want it to be at the top only for one subject(Maths) and for other subjects(Chemistry, Civil, Electrical) the location it gets according to the alphabetical order.

My second approach is to create an additional term reference field called Important Subjects and mark only the subject that I need the node to appear at the top(Maths). I'm trying to add some logic at the template level with no success.

To complicate the matter further, since I'm using Nice Taxonomy Menu, I have to stick with the view (but can modify this view) that they provide with the module.

Any help appreciated. Thanks


texts: Views 3: template suggestion file for header/footer parts?

texts:
In Views 3, is there any type of template suggestion for header and footer parts of a view?

I know I can paste Full HTML into Global Header and Footer fields, but - as I have the main part themed in a tpl file - I'd also find it more comfortable to have the header/footer parts laid out in an external text file.


texts: Commerce Feeds failing to import due to missing bundle property

texts:
I have a fresh install of Commerce Kickstart, and using the Commerce Feeds module to import my list of products from a CSV.  I mapped my fields (sku, title_field, commerce_price:amount, field_commerce_saleprice:amount, and product_id) to the fields in my csv.  I am using a CSV parser, File upload, and attaching it to a standalone form.  When I process the import of either 1 item, or my full list (474 items), none of them import due to the following error:

Missing bundle property on entity of type commerce_product

Here is the entity from the log:

Entity

(object) array(
  'type' => 'product',
  'product_id' => '588',
  'is_new' => FALSE,
  'sku' => '052-001-014588',
  'uid' => '1',
  'status' => 1,
  'created' => 1447383612,
  'changed' => 1447383612,
  'log' => 'Created by FeedsCommerceProductProcessor',
  'revision_timestamp' => 1447383612,
  'revision_uid' => '1',
  'original' => FALSE,
  'title_original' => '',
)

I can't seem to figure out why they won't process and import.  Can anyone help?  Let me know what information you'd like to see.


texts: Drupal views custom filter, check if row exist

texts:
I need help with a query. I am having a really hard time going in the right direction.

I have a custom multi-value field, containing one 'name' and one 'id'.
I want to filter on contents that:

None of the delta has a name 'test' ('test' is a name example).
OR, the name is 'test' and the id is equal to 0.

I was planning on having the logic in the customer filter, like so:

class my_module_handler_filter_field_name extends views_handler_filter_boolean_operator {
  function query() {
      // My custom code here
  }
}

But I don't have much success for now. I managed to filter rows where 'name' = 'test' using:

$this->query->add_where($this->options['group'], 'field_name', 'test', 'LIKE');

But if I do the opposite with 'NOT LIKE', it just shows me every row not equal to 'test' (also including rows from an item that has one name = 'test'). This behaviour is normal, I know it is simply not the right way.

A table example:

    entity_id    delta    store_name  id_in_store
    ---------------------------------------------
    1            0        Amazon      0
    1            1        BestBuy     123442111
    2            0        Apple       123442123
    2            1        Microsoft   124423459
    2            2        Google      112559002

Entity_id is a node ID for a 'product' content type. I want to be able to know which products are sold at Amazon. And there are 2 ways to know it:

The field have a delta where store_name is 'Amazon', but id = 0.
Or the the field doesn't have any delta where store name is 'Amazon'.


texts: How i change scripts in my custom theme in drupal 6

texts:
i write a custom theme for my site and i want to remove misc/tableheader.js script from site scripts and add my own tableheader.js instead.
is any way to i do it without changing original misc/tableheader.js file?


texts: Using Drupal 8, is there a way to disable the links of the Forum Containers on the Index Page of the Forum (Forum is activated via the Forum core Module)?


texts: How to fix the fatal error due to cached data while migrating?

texts:
I was trying to migrate my site from one computer to another. I have imported .sql file from database from my first database (unfortunately forgot to clear cache) and created a new database in the second and exported the data. Then i have tried to point the settings.php's database array to the newly created database in the second computer but when i tried to access the page, i get a white screen with the following error

  Fatal error: require_once(): Failed opening required '/var/www/html/sites/pullup.local/modules/remote_stream_wrapper/remote_stream_wrapper.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/includes/bootstrap.inc on line 3186

Where sites/pullup.local was my site folder in the first computer which is not present here. Then i tried to remove all the entries in the database starting with "cache". Even after clearing all the entries in the cache tables i am getting same error and I am not understanding that from where old folder path coming.

I also tried to remove the database entry from settings.php then it is working normal as the web installation page coming up. So I think something caches the old folder in the database (DRUPAL_ROOT variable value is cached).

How can I fix the problem?


texts: Drupal 8 Installation Is Just Plain HTML

texts: I just installed Drupal 8 in a subdirectory. I pushed all of the files to the directory, I installed Drupal with a minimal setup and and edited my .htaccess file to make Drupal work with my subdirectory. Now, it displays my website, but without any CSS or Javascript. It's just plain HTML text. How can I fix this problem?


texts: Altering select elements to include data-img-src

texts:
I am trying to create a content type with select list options that are replaced by images that you can pick.

Plugin here http://rvera.github.io/image-picker/

How would I go about altering the option element to include the data-img-src option?

<option data-img-src="img/01.png" value="1">  Page 1  </option>

Any help would be appreciated.


texts: Drupal 8 creating a custom Views filter plugin

texts:
I am trying to create a custom Views filter plugin. Basically it should read the current path, check the relevant path field in the node (defined as text-field) and get that content. I'm stuck around generateOptions() function and defining "Content: Filter by path if avail (= field_pathoes)" – please see screen shot below and code.

 <?php
/**
 * Implements hook_views_data_alter().
 */
function atc_views_filter_path_views_data_alter(array &$data) {
    $data['node_field_data']['field_pathoes'] = array(
        'title' => t('Filter by path if available'),
        'filter' => array(
            'title' => t('Filter by path if avail'),
            'help' => t('Checks current path and if value in path_field match, then the content is used.'),
            'field' => 'type',
            'id' => 'atc_views_filter_path_field_pathoes'
        ),
    );
}

/**
 * @file
 * Definition of Drupal\atc_views_filter_path\Plugin\views\filter\NodeTitles.
 */

namespace Drupal\atc_views_filter_path\Plugin\views\filter;

use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\filter\Equality;
use Drupal\views\ViewExecutable;
use Drupal\Core\Url;

/**
 * Filters by given list of node title options.
 *
 * @ingroup views_filter_handlers
 *
 * @ViewsFilter("atc_views_filter_path_field_pathoes")
 */
class PathValueFilter extends Equality
{

    /**
     * {@inheritdoc}
     */
    public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
    {
        parent::init($view, $display, $options);
        $this->valueTitle = t('Path filter to be included');
        $this->definition['options callback'] = array($this, 'generateOptions');
    }

    /**
     * Override the query so that no filtering takes place if the user doesn't
     * select any options.
     */
    public function query()
    {
        if (!empty($this->value)) {
            parent::query();
        }
    }

    /**
     * Skip validation if no options have been chosen so we can use it as a
     * non-filter.
     */
    public function validate()
    {
        if (!empty($this->value)) {
            parent::validate();
        }
    }

    /**
     * Helper function that generates the options.
     * @return array
     */
    public function generateOptions()
    {
        //use Drupal\Core\Url;
        $current_route = Url::fromRoute('<current>')->getInternalPath();

        return array(
            'field_pathoes_value' => $current_route,
        );
    }

}


texts:
Has anyone seen a module capable of providing line item revisions? I am calculating the cost of a custom line item type via rules. It is essentially a booking and may need to be altered in the future.

I am therefore looking for some information from anyone who may have had a similar issue? This is what I need.

Every time I recalculate the price of a line item on an order to create a new revision.
Always display the latest revision to the user.
Provide a view showing other revisions in the admin panel.


texts: How do I fix missing input fields in panels

texts:
The site I am working on is Drupal7 site, built of panels and pages, panelizer.  Typical steps to edit, admin logs in, click on the "customize this page" button, various panels open up, click on the gear of the panel you want to edit, edit screen opens, make your updates, click finish then slick save, and all is right with the world.
Yesterday one of the editors, following the steps above, attempted to edit, but the panels input box, for some reason, the actual area where you would add the content is collapsed/gone.

It should look something like similar to this:

Anyone have any idea on what is causing this or where should I even start checking to see why all the fields are not displaying?
Any and all suggestions would be appreciated.
Thanks in advance.


texts: Unable to select date values in views filter(exposed grouped filter) implemented through Datepicker module on a Date Type form field

texts:
Pre-requisite knowledge:

I have a view - All Albums to list all content of Album
content-type.
I have a field in Album content-type - Release Date of type
Date.
I use Datepicker module (enabled Datepicker block and Datepicker
Views as well) in the Views Filter handler in Date filters (filter
on Release Date field in this case).
In View Edit overlay for All Albums View, I created a new filter
on Content: Release Date.
Then, under Configure extra settings for filter criterion..., set
Date selection form element to Select and Filter granularity to Year (these extra settings are being implemented)
Then, under Configure filter criterion, exposed this filter to
visitors and selected Grouped filters.

Problem Statement
I expected something like this to appear under Value column:

But I am not getting it!
I guess this is a bug in Datepicker module but can't say for sure.
Moreover, I want to expose this date value under Value column to site-user/visitor; how to do that?


texts: How to show a secondary vertical axis to the right of a chart when using charts module?

texts:
I have created a chart of two variables, using Charts module. To do so, I used the Views integration of the charts module, and selected 'Chart' as the views style.

The result I got so far is that the chart is shown using the same vertical axis (y-axis) on the left (one for each variable).

Question: Is it possible to use two vertical axes, so that the primary axis is shown on the left of the chart, and the secondary on the right?


texts:
Currently I am building two content types, and I would like to consolidate them into one. Here is the scenario. I have two content types - Restaurants and Shops. These two have exactly identical fields except for 'Category' which is a taxonomy list. For restaurants, the taxonomy list contains restaurant food categories (asian, italian, etc) and 'shop type' for shops (fashion, electronics, etc).  The only reason I have two content types is so that I can enforce the category field which is required.

However, in my mind it seems like it would be better to just have one content type.  What I would like to do is create a 'Business' content type where you then select what type of business. In this case, Shop or Restaurant, for example. When the appropriate Business type is selected, the corresponding taxonomy to describe that particular selection will become apparent, and be able to be enforced. So, if I choose 'restaurants' then the restaurant types list will become visible where as selecting shops will display the shop type list.

Any thoughts on the best way to handle this architecture?


texts:
I am having problems installing drush 8 in ubuntu 16.04. when i insert the following command in the terminal

composer global require drush/drush:dev-master

i get the following error

I have also tried the documentation from drush.org

php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > drush

but i get the following error msg

  bash: drush: Is a directory

I am currently stuck.


texts:
I have multistep webform and it works well. Each step has "Prev" and "Next" buttons and I can move trough the steps with them.
Now to some single step I need to add additional "Next" button which I plan to recognize in my custom submit handler and do some different action when that button is clicked comparing to standard "Next" button which exists on all pages.
So I added button for that step only, it appeared and it seems to work. However it doesn't have custom title I set for it, but have the same "Next" title as regular next button?!?
So inside right side options for this new button, for "Prev" (since I don't need it) I checked "Hide wizard previous button" and it's ok - Prev button is hidden.
And inside "Wizard next button" section for "Wizard next button label" I set some different value, but it's not used on front-end?
I tried to debug it a bit but inside my hook_form_alter when I drill down to this button value I entered on the back-end is there:
$form['elements']['step_machine_name']['actions_01']['#title'] = "My new button title"

and also
$form['elements']['step_machine_name']['actions_01']["#wizard_next__label"] = "My new button label"

really do have the values I set, different from "Next", but on front, for this new button title "Next" is displayed?!?
Why is that? Why button label value I defined is not used?
Even worse - it's like the same "Next" button is printed twice with the same footprint. In my submit handler I get totally identical values for both:
$form_state->triggering_element["#submit"][0] = "::next"

so I can't recognize which one is pressed.


texts: how to enable Comments in lightbox or colorbox

texts: Is there a way to make comments on a node (photo) available when lightbox or colorbox is in action? I mean how can you make a comment box appear underneath a node (e.g. Facebook)? I am using drupal 7 and zen sub theme. Thank you in advance.


texts: How to grant permission to FileSystem.php file

texts:
I navigate to admin/config/media/file-system in the drupal admin interface. I get this error

  Warning: mkdir(): Permission denied in Drupal\Core\File\FileSystem->mkdirCall() (line 244 of core/lib/Drupal/Core/File/FileSystem.php) .

I granted the permission to sites folder using the following commands chown -R www-data:www-data sites and chmod -R g+rw sites.
But still the error appears.

Any advice?


texts: DIsplay Block content after certain time delay

texts:
I need to show the block content to users after certain delay of page load . Initially the user will see only the article , but after certain time the block content will be revealed . Can it be done ? any pointer is appreciated .

Thanks
Pankaj


texts:
I used the examples found here as my AJAX guide.

I have a custom form field

$form['elements']['refunded']

which is entirely defined in a single line as an array.  My AJAX DIV's and callbacks work perfectly.  In the attributes field, I call a custom function that sets a CSS property.  No problems at all.

I need to duplicate this same functionality with another field on the same form.  The field is 'status' - but it is defined elsewhere and I don't know where or have access to the code where it is defined directly.

Thus in my code, I append to the array for the form field such as :

$form['elements']['status']['#prefix'] = '
';
$form['elements']['status']['#suffix'] = '
';
$form['elements']['status']['#disabled'] = myfn_disable_attendance($form_state);

When I update the attendance select field, it should update the ability of a user to change the status (i.e. is marked as attended, the student can no longer withdraw from the class).

Disabled should display the status, but not allow the user to modify the field.

The last piece is the callback that runs when the attendance select is changed, that is a single-line return:

  return $form['elements']['status'];

Which is the same as I use in the working example, however for that it is ['elements']['refunded'] which if you see above, is defined on a single line.

When I modify the attendance field, the status field disappears and displays what appears to be the return code from my function that should be setting the display option to true/false.

It appears it is not re-building the entire form field.  My call to return $form['elements']['status'] and Im thinking it may be due to it being defined on multiple lines in multiple php files.

Can anyone provide any pointers as to how to accomplish what I'm trying to do or help me identify what the code is actually returning from my callback function so I can better get a grasp on what I need to do here?


texts:
I saw in this post that D8 does not support the passing of extra menu arguments. Several posts on DA gives workable solutions, but they don't fit this use case.

The contrib module I am porting depends heavily on using those the extra arguments passed to on the route /node/1/my_thing. Adding my_route causes a page_not_found error.

my_thing is not a tab but a parameter that generates content to merged into the view of the node.

As far as I know I cannot alter the behavior of core's route entity.node.canonical


texts: Is there a hook invoked after user confirmation?

texts:
This question asks it (presumably for Drupal 7), but the solutions all appear to be specific to D7 and not applicable in D8, so that's effectively a different question.

It appears that hook_ENTITY_TYPE_presave() could be used used, but what checks would need to be done to check that it's the user confirmation (password added)?


texts: Define a Panels visibility rule programatically

texts:
I'm trying to define a Panels visibility rule (access plugin) programmatically but I'm running into a problem.

My code is below.  This code works as a Selection Rule (on the Access tab), but when I try to add my access plugin as a Visibility Rule (on the Content tab), the plugin is added to the panel pane, but it doesn't show up in the UI under "Visibility rules."  So there's no way to delete it, and the title isn't shown.

I assume I failed to declare something that makes it show up in the Visibility Rules, but I haven't been able to figure out what.  I was following this guide, but my plugin is simpler than the one in the example (no configuration necessary).

<?php
/**
 * @file
 * Plugin to check whether the value matches the proximity query string
 * https://drupal.stackexchange.com/questions/33336/what-are-ctools-plugin-content-type-access-etc-and-how-does-one-create-them/33337#33337
 */

/**
 * Plugins are described by creating a $plugin array which will be used
 * by the system that includes this file.
 */
$plugin = array(
  'title' => t("Check proximity query string"),
  'description' => t('Returns FALSE if the proximity search query string is set'),
  'callback' => 'mymodule_checkproxquerystring_ctools_access_check',
  'settings form' => 'mymodule_checkproxquerystring_ctools_access_settings',
);

/**
 * Settings form for the 'term depth' access plugin.
 */
function mymodule_checkproxquerystring_ctools_access_settings($form, &$form_state, $conf) {
  return $form;
}

/**
 * Check for access.
 */
function mymodule_checkproxquerystring_ctools_access_check($conf, $context) {
  if (isset($_GET['d']) && (is_numeric($_GET['d']))) {
    return FALSE;
  }
  else {
    return TRUE;
  }
}


texts: bulk importing data in articles node catagory based

texts:
Hello how to bulk Import XML feeds -Content from xml systems category base to drupal

Hello I have custom CMS we are moving to Drupal.Our custom CMS has bulk post system via XML feed.
We post 1000 articles/News via xml per hour on our CMS.

We need to know how to import bulk xml as Categories (Taxonomy) base.

Here is our xml file below

  Sports
  Title
  Image Location

    Bulgaria votes in parliamentary poll
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. At vero eos et accusam et justo duo dolores et ea rebum. Sanctus sea sed takimata ut vero voluptua. Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
    tag1,tag2,tag3
    2/15/2015 8:26:01 AM

     Sports
    Youssou Ndour awarded Polar Prize
    At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Sanctus sea sed takimata ut vero voluptua.Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
    tag1,tag2,tag3
    2/15/2015 8:26:01 AM


texts: Twitter feed on Drupal from multiple accounts

texts:
I want to add several Twitter profiles on my Drupal and create groups of them and show their tweet feeds. At the moment, I found a module which let me add only one Twitter profile. Here is an example:

Group A: User 1, user 2, user 3
Group B: User 4, user 5
Group C: User 6, user 7, user 8, user 9

The create blocks (probably with Views?) and show all the tweets from each group. Another problem, I had with the module I have is that it needs the user to authorize his profile to get his tweets.

Is there any other way to do it without ask from user to authorize and with multiple profiles feature?


texts:
I created a view, and I need to put some PHP or JavaScript in it. I would like to add some if conditions.

Is this possible?


texts: Preprocess image: how to get parent entity?

texts:
I'm using responsive images (single img tag with srcset and sizes attributes). My content editors can manipulate the displayed size of the image with a custom field on a shared parent entity. Therefore I can't meaningfully use the sizes field from the responsive image module, because my editors can set the image size from 10% of a fixed container up to 100vw on per paragraph level.

I know how to preprocess the sizes attributes, but I don't know how to get to my shared parent entity, which holds the field determining the size of the image's parent container:

function template_preprocess_responsive_image(&$variables) {
  // pseudocode: don't know how to this
  $imageField = $variables['whatever'];
  $parentParagraph = $imageField->getParentMediaEntity()->getParentParagraphEntity();
}

My question is how do I get the parent paragraph entity as written above in pseudocode?


texts: Ways to get field dependencies programmatically

texts:
Let's say I have field 'abc' which is dependent on some other field d1, d2 of same content type.

Is there any way to get all the dependencies of field 'abc' programmatically.


texts: Is it possible without change in core files to display exposed filters without "Submit" button and with autosubmint functionality? I mean autosubmit form, not autocomplete.


texts: What is the correct way to handle caching with custom modules?

texts:
I'm experimenting with creating a custom module in Drupal 8. I have created a module that has some custom database tables. One of these tables, "mymodule_tickets" gets populated via admin forms that I have created within the module.

On the public side of the website, I have another custom page setup ('/booking'), which displays a form containing the available 'tickets'. For the mostpart, this works really well, but I am having some trouble understanding caching.

The '/booking' page uses the drupal form api to create a 'number' field for each available ticket. The '#title' of each form field is the name of the ticket as setup in the admin area. When anonymous users view the /booking page, the titles of these form fields cache. If I change the title of the ticket in my admin area, this does not get reflected on the public site for anonymous users.

My first attempt at remedying this was to add this when building the form:

$form['#cache']['max-age'] = 0;

But unfortunately this did not make any difference. Changes to the titles of form elements were still not reflected to the user.

In the end I had to add the following to my routing file:

  options:
    no_cache: TRUE

While this did work and stopped the form titles from caching, it feels like a very heavy-handed way to fix the problem. To me the correct solution would be to cache these pages for anonymous users, but to correctly invalidate the cache after making changes in the admin area.

Are there any guides or code snippets or articles about how to do this? From searching the web I haven't been able to find any relevant information or examples.


texts: How can I wrap each row of a HTML list field view in an a-tag

texts:
I'm wondering how I can wrap an <a> tag around the <li>s rendered by the HTML list in Views.
Unfortunately I only find the option to wrap each field in a custom tag, but not the entire row. Can someone point me to the direction?

How can I do the above for the row of fields, not the field itself.
Edit: I also tried this.

But it doesn't wrap the fields around the a-tag.


texts:
I'm trying to implement pattern but It doesn't work.
Here is the implementation of hook_theme() with my pattern:

Call theme('publication__' . 'news', array('bean' => $bean));

in file atom_publications.module

function atom_publications_theme() {
  return array(
    'publication' => array(
      'variables' => array('bean' => NULL),
      'pattern' => 'publication__',
      'file' => 'atom_publications.theme.inc',
      'preprocess functions' => array('atom_publication_custom_preprocess'),
      'template' => 'publication',
    ),
  );
}

In file atom_publications.theme.inc write this code:

function atom_publication_custom_preprocess(&$variables) {
}

Files in module dir:

publication.tpl.php
publication--news.tpl.php

But render only publication.tpl.php template. Why?


texts:
I am building a site for a client where each page has 3 other pages associated with it.
I know how to create node references but I would like to find a way to limit the user to creating just 3 node references per page.

So each page only allows the creation of 3 references and whrn all of them are created the "add reference" link is removed ( until perhaps one or more of the references is deleted ).

Can anyone suggest a potential solution?

Thanks


texts: Difference between 2 methods of adding a CSS files in theme.info?

texts:
What is the different between these 2 methods of loading a CSS files?

; Method 1
css[typography.css][name] = Typography
css[typography.css][description] = Typography
css[typography.css][options][weight] = 99

; Method 2
stylesheets[all][] = css/typography.css

Method 1 means the CSS file is loaded further down the page head, which I need for my theme. However from looking at the documentation it seems Method 2 is more standard?


texts: How do I include special characters in a path alias?

texts:
I'm trying to add a path alias for a node, /student-&-courses/maths, but in the URL it is displayed as www.testone.com/student-%26-courses/maths.
I unchecked the Generate automatic URL alias option manually set the path alias without adding a pattern. I enabled the Reduce strings to letters and numbers and Transliterate prior to creating alias options in the settings, but it doesn't have any effect: The special characters are not encoded in ASCII format.
How can I fix this so the URL contains special characters?


texts:
What I want to do is setup a "PHP filter" to run the code I'm told to run, and display the results as a normal page.

I also want to be able to have a way to show the code; many websites do it, and I was wondering how I could do so within drupal.
Maybe I could tabs in a content type (one for processed code, other for actual code), or an overlay with the PHP Text, or something to show the text in the "PHP Text Field" easily.

Further Description:
Say I have the following code as the body content of my page.

<?php echo "Hello World!" ?>

Who watch the page would see the code output ("Hello World!"); they would not see the PHP code that generated that output. I want something to display the code.

The output of the Geshi Filter module is the following:


texts: Check if available values of a list-field is already used by other node of content type

texts:
i have a problem regarding fields of type list.

The scenario is the following. I have a content type with several fields, among them a field of type list. This field have 3 values ("1" to "3"). I want any of those 3 values to belong only in ONE node of this specific content type.

In other words, if a node of that content type has the value "1" in that field, i want that value to be "disabled" when creating new nodes of that content type (so, only available options to be "2" and "3").

Do you have any ideas? Is it possible at all?

Thanks in advance!


texts:
Is there a way to set up a Webform such that I can turn component field submissions into tokens for use in the submission email?

For example, I want to include "Message from [email address]" in the email subject line. The default options only allow for including only the component field in the email (subject: [email]), or only custom text.

Is there a way I can turn the component field submission into a token for use in the email? Looks like there's a module for turning webform items into tokens, but it's not for use within webform.


texts: How can I preprocess pager links for a view display?

texts: I've created a custom Drupal 7 block view that uses a mini pager. I need to display the pager-previous and pager-next links as images, and replace the pager-current link with some text. Do I need to create templates for these three links? Do I need preprocess functions for each of them? What are the naming conventions for these templates and functions? They would be tied to a particular block display.


texts: Accessing a selected value instead of key in drupal 8

texts: I need to access values instead of keys from a custom form select field. To get the keys, I am using $form_state->getValue() but I don't know how to access the values. Kindly help.


texts: security kit module settings are blocking own site jQuery calls

texts:
I am using Security kit module to enhance security for my website. In that I have enabled Enable JavaScript + CSS + Noscript protection  option. This setting is blocking one of Jquery call that is .load functionality. The description of this option is here:

Enable protection via JavaScript, CSS and Noscript tag. This is the most efficient Clickjacking prevention technique. If webiste is not being framed, seckit.document_write.js starts commenting with document.write() and stops when reaches stop SecKit protection. Thus seckit.no_body.css, which sets body display to none, is ignored. If particularly this JavaScript file is being blocked (with XSS filter of Internet Explorer 8 or Safari), seckit.no_body.css sets display: none to body. If JavaScript is disabled within browser, it shows a special message.

Below is the js code:

$("[name='dest-target']").click(function(e){
 jQuery("#test_file_download").load(Drupal.settings.basePath + Drupal.settings.pathPrefix + "node/hit/ajax", {'path': filenodeurl});
 return false;
});

Please suggest me any alternatives i can use for this.


texts: Hide webform components after submission

texts:
I'm trying to autohide all my webform components after submission. I've tried to add an extra submit handler to the form, but no luck there.
The webform is posted by using AJAX (but nothing is shown in my Console).

Is there some module or hook I'm overlooking?


texts: Say we have a page like wikipedia page, with a lot of text fields, finally we need an "outline block" to navigate user to find different fields easily, then we need to use anchor in the page, but I found it is not available to use anchor in different fields. Is there any solution for this? Another question is how to embed the "outline block" in the node content (on top of text)?


texts: How can I group checkboxes in my custom ER widget?

texts:
I have created custom entity reference widget. Basically I need checkboxes inside my form element. But they have to be grouped by "Row" field presented on referenced entity type.

I'm not sure is it even possible to achieve that by extending core OptionsButtonsWidget, but here what I have now:

class MapCheckboxes extends OptionsButtonsWidget {

/**
 * {@inheritdoc}
 */
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $form['#attached']['library'][] = 'mymodule/map-checkboxes';

    $element = parent::formElement($items, $delta, $element, $form, $form_state);

    $options = $this->getOptions($items->getEntity());
    $selected = $this->getSelectedOptions($items);

    // If required and there is one single option, preselect it.
    if ($this->required && count($options) == 1) {
      reset($options);
      $selected = [key($options)];
    }

    if ($this->multiple) {
      $element += [
        '#type' => 'checkboxes',
        '#default_value' => $selected,
        '#options' => $options,
      ];
    }
    else {
      $element += [
        '#type' => 'radios',
        '#default_value' => $selected ? reset($selected) : NULL,
        '#options' => $options,
      ];
    }

    return $element;
}
}


texts: How to use redirects on Nodes that are only used to populate block Views

texts:
I have a custom content type that is really only used to populate a views banner, so I don't want that node to ever be browsed to or indexed.

I'm thinking this is a redirect kind of scenario, but I don't know exactly what that should mean. I'm using Clean URLS and Path Auto

Would something like Global Redirect be what I need or is there something else I should use?

Thinking ahead, there are other content type nodes that will have the same requirement.


texts: Change the site name programmatically for a specific page

texts:
I am trying to change the site name when a user enters specific pages on my website.
I know the variable for the site name is $site_name and is being retrieved from the system.tpl.html file.

So I am trying to set different site names depending the URL; for example, when a user visits /about_us, the site name should change.

In my template.php file, I have captured the path in a variable.

$path = drupal_get_path_alias();
if ($path == 'about_us') {
  $site_name = 'New title';
}

This won't work.

How can this be achieved?


texts: Multiple blocks on single page, pager issue

texts:
I have 3 blocks made by views on the front page. Each have 4 of the newest node teasers showing with a pager to see the rest. However, when I click on one of the pager's next button, it will load the next 'page' for all the blocks on the page.

What would be the best way to make it so pressing the next button will only load that specific blocks next page and not the other blocks?


texts: How can you get the route name/path of groups?

texts:
I am new to Drupal 8. I am working on groups module and want to assign different themes to different groups.So i need route name of groups. how to find route name of groups. Thanks in advance.

/**
   * {@inheritdoc}
   */
  public function applies(RouteMatchInterface $route_match) {
    // Use this theme on a certain route.
    return $route_match->getRouteName() == 'i need route name of groups here';

  }


texts: Custom pseudo field not rendered when no other field has content

texts:
Usecase: I want to have a title field in view mode administration to be able to place it between some other fields. This field has different content depending on node type, view mode and some other fields which is handled by a custom function.

Solution so far:

 /**
 * Implements hook_entity_extra_field_info().
 */
function mymodule_entity_extra_field_info() {
  $extra = array();

  foreach (NodeType::loadMultiple() as $bundle) {
    $extra['node'][$bundle->Id()]['display']['mymdoule_title'] = array(
      'label' => t('Extra title'),
      'description' => t('Display the title of the node e.g. in teaser'),
      'weight' => 100,
      'visible' => TRUE,
    );
  }

  return $extra;
}

And then

/**
 * Implements hook_ENTITY_TYPE_view for nodes
 *
 *  - render our pseudo fields
 */
function mymodule_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {

  // if our pseudo field is used we use our costum class to build the render array
  if ($display->getComponent('mymodule_title')) {
    $nodeCustomisation = new NodeCustomisation($entity);
    $nodeCustomisation->titleExtraField($build, $view_mode);
  }
}

It is working as I can see my pseudo field when I go to the view mode administration page of any content type. I can place the field somewhere and it is rendered.

Problem:
As soon as the pseudo field is the only field with content when viewing a node in this view mode nothing is rendered but the node wrapping <article>-tag from node.html.twig. The array {{ content }} in this twig template is empty although the pseudo field should have content for sure - when I add a node field to the view mode which has content I see my pseudo field again.


texts:
How can I make Views form page with such input fields?

Such view can really help to change meanings of some node field all at once.


texts: How to force Devel Generate to use default image when creating nodes?

texts:
I'm using Devel Generate to generate nodes which has an image field. The generation is working fine but devel uses a standar image (sort of color squares) for the created nodes instead of the default image I set in the content type of the node.

Is there any way to force Devel Generate to use the default image instead?


texts:
Admin user wants to be able to upload image banners and select on which pages/nodes/views/panels to show it when visited (as a wide screen image banner above title).

It means when creating the banner node and uploading the image, there should be some field or list of pages to select from. But e.g. Views pages has no NIDs.

I kind of came up with a solution with Panels, where you just add field for your Article content type and upload the banner and then display it via Panels, so it would show above Title, etc. But it works only on node pages, but not Views pages. And that's still very limited, it means you need to add the banner field to every content type and still no solution for Views pages.

Is it possible somehow to have some type of a field that would autocomplete the path/node nid/view path when entering keywords and would be also separated by comma for multiple paths/pages and then render it via Views using contextual filters and output the view display via Panels?


texts: Migrate Alt and Title text from a D6 image file field to D8

texts:
I'm trying to migrate a multi-value D6 image field to D8. I've already migrated the files with d6_file and it worked. When I do the node migration with the image field works and I get all the values but the alt and title text are not migrated.

  field_image:
    plugin: sub_process
    source: field_image
    process:
      target_id:
        plugin: migration_lookup
        migration: upgrade_d6_file
        source: fid
      alt: alt
      title: title


texts: How to associate a node with a menu without adding it to the menu

texts: Since menus drive the breadcrumbs by default in Drupal, is there a way to associate a node with a menu without actually adding it to the menu?  I am trying to maintain a concise menu that nodes can be associated with on the node edit page, without having every node that I associate with the menu then becoming yet another item in an ever growing menu tree.


texts:
I am trying to create a custom search page with two input fields.

Company Name and Certification Code are two fields to be entered by user.

I have a content type called certification and the search will be performed based on this Content type.

A field collection is used to enter certifications details(Certificate Name     ,Certificate Number    ,Certificate ,Issuing Date: ,Date of Expiry).

The result page will separated one or under the same page of search form.

I tried many ways and i am not convinced with the results. I created a page node--certification.tpl to show the result

Here i want two things :

In the search page Two input fields to be entered  ,the combination of two items in content type(company name,Certificate number.) Here certificate number is a field collection value.I couldn't search from the field collection.I used custom search module.
Show the result in this page directly when we search from the search page instead of showing the intermediate result page.

Search Page

Search Result looks like

I hope someone will help me to get a perfect search page.


texts: Adding custom tpl.php file for a new or edit node content

texts:
I am having issues with overriding the "add form" for a content type with a tpl.php file. The following works fine when its not an "add form".  Any advice? Here is what is in my hook_theme function.  And I have a data-set-node-form.tpl.php file in the /templates file with my html.

$items['data_set_node_form'] = array(
  'arguments' => array('form' => NULL),
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'bootstrap_subtheme') . '/templates',
  'template' => 'data-set-node-form',
);

Thanks for the help.


texts: Track clicks in Drupal 7 and querying with Views

texts:
I'm looking to log clicks from generated URLs that are sent via email.  I need to be able to query these log entries and display the results to my users using the Views module.

What I need to track.

Unique ID from URL clicked.
Date and Time URL was clicked.
Node reference (Predefined from UID)
User reference (Predefined from UID)

Currently, my plan is to create a new content type and use references as a makeshift logging system, but this seems very bulky and expensive. Is there a way to drastically improve node_save() performance?

What would be the recommended way to accomplish a click log in Drupal?  Low overhead and Views integration are important.


texts:
I'm working on a website for the elemantary school of my kids.
The parents should have the option to login to the site to consult information (children in classes, addresses of other parents,...).

Currently I've created one 'family' user account where the additional information (second parent, children, class, addresses) is stored in profile2. The problem is that when the parents are divorced the second parent should have also a user account (with a different password) but the profile2 information should be the same. So I need two user accounts with the same profile2 info.

How can I manage this in Drupal?

Thanx!

Jan


texts: i am new to Drupal. I have few nodes with term reference. After creating nodes with term reference, i want to redirect user not on created node, but on term page. Is this possible?


texts: How do I limit the access basing on the user role?

texts:
How do I use an access callback to limit the access basing on the user role?

For example, in my site I have the following roles:

Administrator
Authenticate User
Anonymous user
Teacher

I want to make a particular page available only to the users who have the Teacher role. How can I achieve this?

function form_test_menu() {
  $items['programme_reg'] = array(
    'title' => 'Approved Programmes Registration',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('form_test_form'),
    'access callback' => 'user_access',
    'access arguments' => array('Teaching')
  );

  return $items;
}

My code is not working.


texts: DrupalSettings are not passing the values from block to js?

texts:
I have been trying to pass the variables from block to jquery.

In Block.php,

return [
      '#theme' => 'block--exampleblock',
      '#value' => 'test',
      '#attached' => [
        'drupalSettings' => [
          'example' => [
            'data' => $data,
            'color'=> $color,
          ],
        ],
        'library' => [
          'example/examplejs',
        ],
      ],
    ];

and I used the data and color values in js

drupalSettings.example.data;
drupalSettings.example.color;

and belows are added the dependency in the library

dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings

After uninstalled and installed the modules, The variables have been passing from block to js.

But After clearing cache or sometimes Its not working.

Its showing an issue like

Uncaught TypeError: Cannot read property 'data' of undefined
    at Object.attach (charts.js?v=1.x:10)
    at drupal.js?v=8.6.16:25
    at Array.forEach (<anonymous>)
    at Object.Drupal.attachBehaviors (drupal.js?v=8.6.16:22)
    at drupal.init.js?v=8.6.16:16
    at HTMLDocument.t (ready.min.js?v=1.0.8:4)

I am not able to fix this issue.

Can anyone help to solve this?


texts: How to use drush with a specific PHP Instance

texts:
What drush command can I use to tell drush to use php 5.6 instead of 7.1 which my  site is currently running on.

A million thanks in anticipation.


texts: How to use feeds module to import multi-value fields?

texts: I want to import a csv file using the feed module. This feed corresponds to an article content type, but the problem is the image field in the article content type contains multiple images. If I want to use the feed module to import, I can only import one image, if I paste multiple image urls, this causes errors.


texts: After deleting all users, how do I reset the user ID to start from 2?

texts:
Possible Duplicate:
  After deleting all nodes, how do I reset the node ID to start from 1 again?

This is a very similar question with After deleting all nodes, how do I reset the node ID to start from 1 again? but was wondering how this can be done for User table in Drupal 7?


texts:
I would like to create a MySQL view for another application looking at the Drupal Database. I thought I would get a jump start on figuring out the select statement needed by creating a Drupal View, then copying the generated SQL output. After doing this however, it doesn't seem that the actual SQL statement is outputted. From Drupal views it is showing:

SELECT node.title AS node_title, node.nid AS nid, node.uid AS node_uid, node.created AS node_created, 'node' AS field_data_field_ticket_category_node_entity_type, 'node' AS field_data_field_client_username_node_entity_type, 'node' AS field_data_field_ticket_hostname_node_entity_type, 'node' AS field_data_field_ticket_priority_node_entity_type, 'node' AS field_data_field_ticket_source_node_entity_type, 'node' AS field_data_field_ticket_type_node_entity_type, GREATEST(node.changed, node_comment_statistics.last_comment_timestamp) AS node_comment_statistics_last_updated, 'node' AS field_data_field_ticket_owner_node_entity_type, 'node' AS field_data_field_vis_group_node_entity_type, 'node' AS field_data_field_ticket_status_node_entity_type, 'normalizedticket:page' AS view_name
FROM
{node} node
INNER JOIN {node_comment_statistics} node_comment_statistics ON node.nid = node_comment_statistics.nid
WHERE (( (node.status = '1') AND (node.type IN  ('ticket')) ))
ORDER BY node_created DESC
LIMIT 10 OFFSET 0

I don't understand what it is doing here: 'node' AS field_data_field_vis_group_node_entity_type Is views doing some additional processing after this to get the data? Is there a way to get a query that when run against MySQL directly, it will output similar results to that of views?


texts: Problems while migrating drupal website from localhost to server

texts:
I am trying to migrate my Drupal website from localhost to server, but I am having some problems. I tried many guides from Google, but with no luck.

What I did:

First I did a fresh drupal installation on server

Once installation was complete I edited the .htaccess file as

RewriteBase /site-name

Then I used mysqldump to dump my database from localhost to server I found that I had total 126 tables in localhost while in server I had 128 tables

Then I copied my complete "sites" directory from localhost to server

My problem:

Now when I enter www.mysite.com/site-name I get proper home page of my website but if I go to any other link such as www.mysite.com/site-name/user it is not able to open the page but if I enter www.mysite.com/?q=user then it works perfectly and this happens for all pages such as /content, /config etc.

What should I do to solve this issue? I think it is a problem of clean-urls So I went to configuration but it said clean URL enabled but test failed!

I need to make website live by tomorrow so need your help!

Note: I am using ubuntu on localhost as well as server

Thanks!


texts: how to get all the last level term id's of taxonomy in drupal 7?

texts:
i have a  taxonomy

 State
      - district 1
          -block 1
            -village 1
            -Village 2
          -block 2
          -block 3
      - district 2
      - district 3

How to get all the term id's of all the villages in a state?


texts:
I have below code

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$html = curl_exec($ch);
$redirectURL = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
curl_close($ch);

In Drupal 8 way we can use

$client = \Drupal::httpClient();

$response = $client->request('GET', $url, [
  // To add
]);

Not sure how to pass needed parameters/convert it to drupal way.

[UPDATE]

$uri = 'http://domain.com';

$client = \Drupal::httpClient();

$actual_uri = NULL;
$response = $client->fromOptions([
    'allow_redirects' => [
      'on_redirect' => function (RequestInterface $request, ResponseInterface $response, \Psr\Http\Message\UriInterface $uri) use (&$actual_uri) {
        $actual_uri = (string) $uri;
      }
    ],
  ])->send($request);

dump($response);
exit;


texts: How to format the display of webform_select_options_info to include an image?

texts:
Looking for some guidance on how to approach the formatting of the results of webform_select_options_info. What I want to present to the users is a dynamically populated list of items they flagged along with a checkbox. What I'd like to do is show a thumbnail of the image, the node title and a checkbox in  my list.

The function as I have it now is as follows

 function webform_hook_user_flag_sample_requests() {
   $view = views_get_view('webform_flag_views', TRUE);
   $view->set_display('webform_options');
   $view->execute();
   $options = array();
   if ($view->result) {
     $row_class = $view->style_options['row_class'];
     $attributes = $row_class ? " class='$row_class'" : '';
     foreach($view->result as $item) {
    $options[$item->product_id]= $item->commerce_product_title;
      }
       }
   else {
     $options[0] = t("Nothing");
   }
return $options;
      }

I'm not sure how to change the foreach loop to include additional fields?


texts: I Cant enable the Responsive-Navigation module after installing it

texts: I want to make the Nav menu responsive for my website and I just downloaded the files for Responsive-Navigation and responsive-nav.js plugin and copied them in modules and libraries folders respectively. The problem is I can't enable the Responsive Navigation module. Help


texts: Any way of not to render the pane in panel using custom module?

texts: I dont want to use PHP visibility rule  to add a custom condition but I want to hide a pane based on some condition. How can I do that?


texts: How to add 'title' attributes to breadcrumbs links?

texts: I'm currently using Crumbs module for creating breadcrumbs on my website. I added 'short title' field to nodes and show its content in breadcrumbs instead of much longer node titles. This makes breadcrumbs shorter and much prettier however it is sometimes difficult for users to understand links destinations as I often use abbreviations as 'short titles'. Would be nice to add the full node titles to the breadcrumbs' links (they will be shown on hover as a guide for users). I haven't found any solutions to achieve this so far. Any ideas?


texts:
I have set up a Drupal View (as a block) listing a number of books in my left sidebar (an unformatted list of fields, title, image etc.), in the main area the individual book is displayed as you click on the image in the left sidebar. Is it possible to use the contextual filters to disable that particular book from my view in that left sidebar?
I'm relatively new to Drupal! Many thanks if anyone can help!


texts: Adding a link to a node in a Views export

texts:
I'm using Views data export to export a view-based search as a CSV file for users. Basically it's working. However I'd like to customize how some of the fields come out in the CSV.

Specifically for this question I'm interested in learning how to export the link to the NODE that is returned. It doesn't have to be an active link per se (although that would be ideal), but just the URL to the node would be great too.

I've tried adding Content: Link to the Fields area but that just exports as 'View' for every single returned node. Not helpful.

I've tried returning my title which is currently set to link to the original content but the export doesn't return it as a link. It just returns the title.

I've tried returning the title and making it return as a link with Content: Link as the URL (absolute path selected). But that doesn't nothing.

Anyone have suggestions?


texts: How to not have "-None-" as default in the entity reference display widget

texts:
I spend hours to  figure this out but no result.   I want to auto-populate a
field using entity references and views.

A field has a user entity reference
Using filters, I made a view narrowing down the results to 1 (the result I
want to populate the field with)
I linked the field with the search result using "Views : ..." as a
reference method.

The only thing that's preventing me from succeeding is that the widget always
shows 2 results instead of 1 (SEE SCREENSHOT):
- None -   (Default)
My result  (Dreece in the screenshot)

so the "-None-" is preventing me from succeeding to do the auto-populate.

Any way to (NON PROGRAMMATICALLY) ommit the "-None-" (or put it as the second
option)?
- By configuring the View
- By using View arguments?

Many thanks in advance!!!


texts: Easy steps for adding the imported content on one single page for display

texts:
I have imported the data using the Feeds module from an Excel file.

But as I am new it has created multiple article nodes. I want all these articles to be shown under one article list page. Please explain step by step how can I move forward.


texts:
I am maintaining a site that I did not build.  It was discovered that some 300 nodes of type "custom" had incorrect url aliases.  There are a total of 7961 nodes of type "custom" in the site at this moment.

$ drush sql-query "SELECT COUNT(nid) FROM node WHERE type LIKE 'custom';"

I have found the list of solr drush commands, and I see that solr-delete-index is able to remove a specific content type and then solr-mark-all could be used to indicate they should all be reindexed.  My question is, how can I reindex only the 300 bad ones on this live site.
I do have their nids in a separate csv file already, made from a custom sql query.

Just to be clear:

the site is live and important it stays that way
there is only a small portion of the content type that needs reindexed
I have all the permissions and access, no need to ask if I can get somewhere.  Assume I can.
I have the means to identify the nodes to reindex and pipe them to various things and languages.  I would even xargs a custom drush script if you have a means for doing this to a single node.


texts: How to apply a sequential number pattern in Pathauto?

texts:
If the path name is same, I want to show display as below.

I want:

example.com/blog/path001
example.com/blog/path002
example.com/blog/path003 ...

currently:

example.com/blog/path
example.com/blog/path-1
example.com/blog/path-2 ...

But I don't know how to apply these patterns?
What should I do?


texts: Uninstalling modules, specificially ANSWERS

texts:
I have uinstalled and reinstalled this module MANY times, all of the fields i have created and settings, and ADD question content are there no matter what i do.

here's the order i did

unchecked in modules section
then uninstalled, then deleted via ftp
then clear cache

everything is still there, any help is appreciated, thanks!!

signed--newbie


texts:
I have three content types: A, B and C. C references B (one to many) and B references A (one to many). Each content type has a Title field; A also has a Type field.

I want to output the titles of all the nodes from a C node, where Type in an A node is equal to XY. I don't seem to be able to set up relationships in view for B -> A.

Can anyone point me in the right direction?


texts: Host Drupal site from Dev desktop to Acquia cloud - error

texts:
I'm trying to host my Drupal site from Acquia desktop to Acquia cloud but I get the error - "Drush was unable to create site archive" . Any assistance would be appreciated. Also note, I am just starting to learn Drupal and have little to no programming experience. Full error message below:

Drush was unable to create site archive.
StdErr:php.exe "C:/Program Files (x86)/DevDesktop/tools/vendor/drush/drush/drush.php" --php=php.exe  --backend=2       [notice]
--verbose --root="C:/Users/Robert Kitchen/Sites/devdesktop/drupal-8.4.4" --uri=default  sql-conf   --all 2>&1
Executing: bsdtar.exe  --exclude "drupal-8.4.4/sites" --dereference -cf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4
Executing: bsdtar.exe  --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/all
Executing: bsdtar.exe --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/README.txt
Executing: bsdtar.exe --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/sites.php
Executing: bsdtar.exe --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/example.sites.php
Executing: bsdtar.exe --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/development.services.yml
Executing: bsdtar.exe --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/example.settings.local.php
Executing: mysql --defaults-extra-file="C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp\\dru8702.tmp" --database=newsite --host=127.0.0.1 --port=33067 --silent  < "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp\\dru86F1.tmp"
Calling system(mysqldump --defaults-extra-file="C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp\\dru8761.tmp"  newsite --host=127.0.0.1 --port=33067 --no-autocommit --single-transaction --opt -Q  > "C:\\Users\\ROBERT~1\\AppData\\Local\\Temp/drush_tmp_1519595877_5a933165c1079/newsite.sql");
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_QUOTE_SHOW_CREATE=1' at line 1 (1064)
Database dump failed                                                                                [error]
Executing: bsdtar.exe  --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" newsite.sql
php.exe "C:/Program Files (x86)/DevDesktop/tools/vendor/drush/drush/drush.php" --php=php.exe  --backend=2       [notice]
--verbose --root="C:/Users/Robert Kitchen/Sites/devdesktop/drupal-8.4.4" --uri=default  core-status 2>&1
Executing: bsdtar.exe  --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/default
Executing: bsdtar.exe --dereference -rf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" MANIFEST.ini
Executing: bsdtar.exe -tf "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar" drupal-8.4.4/sites/default/default.settings.php
Executing: gzip --no-name -f "C:\\Users\\Robert Kitchen\\AppData\\Local\\Temp/newsite.20180225_215755.tar"
Archive saved to C:\Users\Robert Kitchen\AppData\Local\Temp/acquia-drupal.tmp.tar.gz                                [ok]
Command dispatch complete                                                                                [notice]


texts: Why are the commands implemented by a custom module still listed after uninstalling it?

texts:
I registered a new command via Drupal Console using drupal generate:command. I associated the command with a custom module, but after uninstalling the module and removing the module folder, the command still appears when issuing a drupal list command. I couldn't find anything in the Drupal Console documentation relating to this.

How do I let Drupal Console know my module is being uninstalled, so that it doesn't list its commands anymore? Does the module needs to implement a specific method for that, or do I need to run a Drupal Console command for this?


texts: LoginToBoggan and user registration password to allow users register with password and email verification at the same time

texts:
I am using the LoginToBoggan module to enrich the account functionalities. In its settings there is a Set password field; when it's not checked anonymous users can't choose their passwords in registration form but they can receive verification emails.
I need both functionalities: email verification and set the password field in registration form.
I found the User registration password module which allow users to choose password in the registration form.
The problem is when I create a new account. The user can login with the chosen password, but I need they first verify their email.
So the process must be like this:

Anonymous users register and choose their password in the registration form
They receive a verification email
They click on the link given in the email to activate the account

The problems I have now are the following.

Users can log in after registration, even if they didn't click on the link sent via email
The link in the email is a kind of reset password link and not a link to verify the email link

Is there a possibility to fix this and allow users to choose their password in registration even if they still to verify the email they use for the site?


texts: Correct way for a db_query for nodes between two timestamps

texts:
I have a very simple db_query.  I want to look for any node created between two timestamps.

This query works fine in MySQL shell

SELECT nid as id,created as start,title FROM node WHERE created BETWEEN '1403564400' AND '1403650800';

This works fine in Drupal

$data = db_query("SELECT nid as id,created as start,title FROM node")->fetchAll();
echo json_encode($data);

As soon as I add in the BETWEEN conditions below I get an Internal Server Error.

$data = db_query("SELECT nid as id,created as start,title FROM node WHERE created BETWEEN '1403564400' AND '1403650800'")->fetchAll();

I am unsure what I am doing wrong here, perhaps someone can point me in the right direction please!


texts: How to set multiple arguments for views contextual filters from twig

texts:
Am using twig tweak module to render views from Twig file. I have pass multiple values for the country contextual filter in the view. I was able to pass single parameter like:

{{ drupal_view('our_services', 'services',  countryTermId) }}

Not sure how to pass multiple values here:

{{ drupal_view('our_services', 'services',  countryTermId+globalId) }}

This is not working.


texts: Installing on IIS 7/Windows Server 2008 R2/MSSQL 2008

texts:
I am having difficulty connecting to my MSSQL database (locally installed) while proceeding through the Drupal Install. I do not get any errors during the Verify Requirements portion, but not matter what info I put into the Database configuration page, it cannot connect. It does not throw an error like "phpmssql library missing"

This is what I have installed so far.

Windows 2008 Server R2
Internet Information Server IIS 7.5
SQL Server 10.0
Microsoft Drivers for PHP for SQL Server 3.2
php-5.6.21-nts-Win32-VC11-x86
php_pdo_sql_srv_56_nts.dll
php_wincache-1.3.7.9-5.6-nts-vc11-x86
sqlsrv-8.x-1.x-dev
wincachedrupal-7.x-1.10

Should I be putting something besides "localhost" and "1433" in the "Advanced Options" panel?

Thanks in advance for any help!


texts:
i am relatively new to drupal . thus i am trying to make an sso system work . i have this parent domain "domain.com" and the drupal site is running on sub.domain.com  . i can read the cookies and all . i come from a laravel background . i made a custom module following the docs . and i managed to make a middleware that intercepts all incoming requests . but i only need it to execute the actual middleware logic for anonymous useres which i am failing to do because var_dump(\Drupal::currentUser()->isAnonymous()); returns true no matter how low my middleware priority is . and it doesnt matter if i read the user from that statement or using the current_user service . its still and empty object because in my mind the middleware is executing before the session module

my services file.

services:

  sso.manager:

    class: Drupal\sso\StackMiddleware\SsoManager

    tags:

      - { name: backend_overridable }

  http_middleware.sso:

    class: Drupal\sso\StackMiddleware\SsoMiddleware

    arguments: ['@current_user','@sso.manager']

    tags:

      - { name: http_middleware, priority: 20 }

i set the priority to 20 because the sessions function at 50 . so it shoud execute after the session middleware is done right ? am i missing something?

my handle method

<?php

namespace Drupal\sso\StackMiddleware;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Drupal\Core\Session\AccountProxy;
use Drupal\sso\StackMiddleware\SsoManagerInterface;

/**
 * sso Middleware.
 *
 * @package Drupal\sso
 */
class SsoMiddleware implements HttpKernelInterface
{

    /**
     * The wrapped HTTP kernel.
     *
     * @var \Symfony\Component\HttpKernel\HttpKernelInterface
     */
    protected $user;

    /**
     * The wrapped HTTP kernel.
     *
     * @var \Symfony\Component\HttpKernel\HttpKernelInterface
     */
    protected $app;

    /**
     * sso manager instance.
     *
     * @var \Drupal\sso\StackMiddleware\SsoManagerInterface
     */
    protected $manager;

    /**
     * Constructs sso Middleware.
     *
     * @param \Symfony\Component\HttpKernel\HttpKernelInterface $app
     *   The wrapper HTTP kernel.
     * @param \Drupal\sso\SsoManagerInterface $manager
     *   The sso manager interface.
     */
    public function __construct(HttpKernelInterface $app, AccountProxy $user, SsoManagerInterface $manager)
    {
        $this->app = $app;
        $this->manager = $manager;
        $this->user = $user;
    }

    /**
     * {@inheritdoc}
     */
    public function handle(Request $request, $type = self::SUB_REQUEST, $catch = TRUE)
    {

        $enabled = $this->manager->isEnabled();
        // var_dump($this->user);//service doesnt return one either
        // var_dump(\Drupal::currentUser()->isAnonymous()); //no user

        // Only run the sso if it's not enabled.
        if ($enabled === TRUE && \Drupal::currentUser()->isAnonymous()) {
            $service_request = $this->manager->isServiceRequest($request);
            // If this is a Web Service request then dont run the sso service.
            if ($service_request === FALSE) {

                // If this is not a service request and the sso service is enabled
                // then get all the settings and send it to sso manager.
                $ssoPass = $this->manager->CheckValidUserCookie($request);
                if ($ssoPass === false) {
                    echo "user doesnt have a cookie let him be";
                    return $this->manager->respond();
                }
            }
        }
        return $this->app->handle($request, $type, $catch);
    }
}

    enter code here


texts:
I set up an English/Arabic Drupal 8 website.
However, comments are misbehaving.
When a user enters a comment in the English version of the article, it appears in the Arabic version, and vice versa.
I went through all the different options I can think of, but I ended up with all comments being treated and displayed as Arabic.
I don't know what I'm missing, or what how I am supposed to configure it.

Shouldn't it respect languages out of the box?

Please, any help or documentation would be greatly useful. Thanx


texts: Let "Availability Calendars" start on monday

texts:
I created this website http://peace-in-the-city.be/en/book-now and on that page you will see I used a Calendar to show the availability of the apartment. ( http://drupal.org/project/availability_calendars )

I tried to let the calendar start on Monday. I googled for the solutions and did change my regional settings local to start of the week to Monday. It worked after that for a couple days. But for some reasons it went back to Saturday. Changing the regional setting has no effect anymore now.

At this point, I'm clueless... Any tips, links and ofcourse working solutions are welcome.

PS. I did not change anything in the rAvailability Calenda module. I'm just install modules - enable/disable - or change configuration.


texts: How do I translate view's page path alias?

texts: I'm able to translate views titles and menus thanks to config_translation core module. I would like to have path aliases translated as well but it seems to lack this feature. Any other way to do it?


texts:
I can't get form-table of '#type' => 'tableselect' to work.  I've lifted the example from 8.3.x core/lib/Drupal/Core/Render/Element/Tableselect.php Tableselect. The table works and there are no log messages.

What happens is the page reports that there are no users found (ie. the table is empty) even though the $form array has the row data in it.

If I change the type to '#type' => 'table' the table is populated as expected.

This is the code I am using.

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

class DisplayTable_1 extends ControllerBase
{

    public function description_one()
    {
        $header = [
            'first_name' => $this->t('First Name'),
            'last_name' => $this->t('Last Name'),
        ];

        $options = [
            1 => ['first_name' => 'Indy', 'last_name' => 'Jones'],
            2 => ['first_name' => 'Darth', 'last_name' => 'Vader'],
            3 => ['first_name' => 'Super', 'last_name' => 'Man'],
        ];

        $form['table'] = array(
            '#type' => 'tableselect',
            '#header' => $header,
            '#options' => $options,
            '#empty' => $this->t('No users found!!!'),
        );

        return $form;
    }

}

Any help would be appreciated.


texts: ckeditor - Two views with editable fields on the same page

texts:
I have put two identical pane views (an original display along with a clone)  on the same page. I needed two copies because each view has its own set of exposed filters, so they can display different nodes side-by-side.

The views consist of multiple editable fields that seem to be identical comparing to the other view so they have even the same element IDs..

As a result, ckeditor which is the default wysiwyg editor only loads on the first view, giving me the following error on console:

Uncaught The editor instance "edit-field-e1-0-field-e1-und-0-value" is already attached to the provided element. ckeditor.js?o5iwm7:286

How can I prevent this? Is there a way to set different ids on cloned displays?

If I recreate the same display manually, would it be any difference? (its a huge display)


texts: Create a Modal to Add new fields dynamically

texts:
I have to develop a contest page. Every participant may have one or more codes that can use to participate in the event. After that the user must fill a form with their personal data so they can be contacted  in case they win the contest.

How could I add a [+] button that opens a modal window asking me how many code field would I need? If I write 5 for example, we create dynamically 5 code fields to the input.

I managed to create an add more button that add just one more button, but for clients requirements, we need to use a popup that ask how many fields we need.


texts: How to remove a views template file in theme folder?

texts:
I put .tpl.php file inside my theme folder to override views output. Then I deleted this file because it was no use for me. And did "Rescan template files". Now it cannot find this file and gives errors on the page.

  File not found, in folder sites/all/themes/mytheme/templates/

I also cleared all my caches.

How can I remove this file for good?


texts: How can I display the price field twice?

texts:
I am using commerce kickstart 2. Here's a screen shot of my product display

I've set a VAT tax rate in Drupal Commerce, so the price in that screenshot is the price of the product, plus the 20% VAT tax.

How can I display the price excluding VAT?


texts:
I am not able to get Drush to recognize the installed PHP 5.4.20 (cli).

$ php -v
PHP 5.4.20 (cli) (built: Oct 10 2013 18:41:48)

$ drush
Your command line PHP installation is too old. Drush requires at     [error]
least PHP 5.3.3.

I logged out and in. Any quick thoughts?


texts: Reducing attached items within node.tpl.php

texts:
I have multiple images attached to a content type that I have set up with fancybox. Currently when viewing that node, all images are displayed. I only want to show the first image, then the rest within gallery mode.

I an struggling to figure out how to limit the diplays within (node.tpl.php) to only show the first attaced image.


texts: How do I download drupal from my webhost so I can run on my home server?

texts:
I have made a database for it in mysql and uploaded the file to my home phpmyadmin but I am not sure which files needed to configured. This is the error I get on the page:

 PDOException: SQLSTATE[28000] [1045] Access denied for user
'mydb_Rem412'@'localhost' (using password: YES) in lock_may_be_available()
(line 167 of /home/magpie/public_html/includes/lock.inc).


texts:
I've the next form.

$form['imagen'] = array(
        '#title' => t('Image'),
        '#type' => 'managed_file',
        '#upload_validators' => array('file_validate_extensions' => array('jpeg jpg png gif')),
        '#upload_location' => 'public://',
        '#progress_indicator' => 'throbber',
        '#status' => FILE_STATUS_PERMANENT,
        '#progress_message' => 'One moment while we save your file...',
    );

That generates something like this:

What I need is to give the user the option to see the image that he has upload, and resize the image. The functionality that I need, is the same that the ImageField_crop module gives.

I'm totally lost. I don't know how to add this functionality to the form.
It's totally necessary for the project to insert this form in a custom module, because I have a multistep form.

Does anybody know how to do this??

Thank you very much.